【发布时间】:2022-01-14 06:45:12
【问题描述】:
我在我的项目中设置了 Firestore。我创建了名为 most 的新集合。在这个集合中,我创建了 10 个文档。但我的代码出错了!
Future getMost() async {
final firestore = FirebaseFirestore.instance;
QuerySnapshot snapshot =
await firestore.collection('most').getDocuments();
return snapshot.documents;
}
getDocuments 出现错误...还有其他方法吗
【问题讨论】:
-
你得到什么错误?
-
@Dharmaraj..这是错误 - 没有为类型“CollectionReference”定义方法“getDocumets”
-
您是否设置了适当的权限
-
@O-9- 是的,我有适当的权限
-
这能回答你的问题吗? The method 'getDocuments' isn't defined for the type 'CollectionReference'。尝试使用
get()中提到的documentation
标签: flutter dart google-cloud-firestore