[英]Why is vs code saying the method '.getDocuments' and the getter documents are not defined for types Query and QuerySnapshot respectively?
void _getQuestions() async {
// Query Firestore for questions with the specified tags
Query query = await _firestore
.collection('questions')
.where('tags', arrayContainsAny: widget.tags);
QuerySnapshot querySnapshot = await query.getDocuments();
setState(() {
_questions = querySnapshot.documents;
});
importing cloud_firestore.dart.导入 cloud_firestore.dart。
I expected the errors to leave, but they are still around.我预计错误会消失,但它们仍然存在。
The method to get the documents is called get()
in Flutter, not getDocuments()
.获取文档的方法在 Flutter 中称为
get()
,而不是getDocuments()
。
I recommend keeping the Firebase documentation handy for this sort of thing, for this case that'd be the section on getting multiple documents from a collection我建议为这类事情保留 Firebase 文档,对于这种情况,这将是关于从集合中获取多个文档的部分
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.