我刚刚更新到 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”。 该怎么办?我需要帮助。