【发布时间】:2021-04-27 10:17:40
【问题描述】:
我得到了 20 cmets 的值,但我只在我的帖子中输入了两个 cmets,我没有找到这个解决方案。在上面我使用流生成器错误时,我在哪里对我的文本进行查询。
流生成器:
StreamBuilder(
stream: FirebaseFirestore.instance.collection("post").snapshots(),
builder: (BuildContext context,AsyncSnapshot<QuerySnapshot>snapshot){
return ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.vertical,
itemCount: snapshot.data.docs.length,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (_,index) {
return
Text('${FirebaseFirestore.instance.collection("comments").where("postid",isEqualTo:
snapshot.data.docs[index].id).get().toString().length}')
}
【问题讨论】:
-
Firebase 实时数据库和 Cloud Firestore 是两个独立的数据库。请仅使用相关标签标记您的问题,不要同时使用两者。
标签: firebase flutter google-cloud-firestore