小编Ade*_*Jr.的帖子

参数类型“对象?” 无法分配给参数类型“DocumentSnapshot”

我刚刚更新到 Dart2 和 Flutter sdk: '>=2.12.0 <3.0.0' 现在出现错误:

return Scaffold(
  body: FutureBuilder(
    future: usersRef.doc(widget.accountiD).get(),
    builder: (context, snapshot) {
      if (!snapshot.hasData) {
        return buildLoading();
      }
      UserAccount currentUser = UserAccount.fromDocument(snapshot.data);
      return ListView(
        children: []
      );
    }
  ),
);
Run Code Online (Sandbox Code Playgroud)

错误出现在snapshot.data上,显示参数类型“对象?” 无法分配给参数类型“DocumentSnapshot”。 该怎么办?我需要帮助。

firebase flutter google-cloud-firestore

1
推荐指数
2
解决办法
3156
查看次数

标签 统计

firebase ×1

flutter ×1

google-cloud-firestore ×1