我想要一列来自我的 firebase 集合的帖子,这些帖子基于高于特定值的标签。由于我的值嵌套在单独的集合和文档中,因此在返回流之前我需要等待未来。
帖子[集合] -> 帖子[文档] -> 标签[集合]->标签[文档] -> 值[字段]
代码根本不起作用,但我正在尝试做的是这样的:
StreamBuilder(
stream:
FirebaseFirestore.instance.collection("posts").snapshots().where((post) {
return FirebaseFirestore.instance.collection("posts")
.doc(post.id).collection("tags").doc("favorites")["value"] > 5;
}
),builder: (context,Asyncsnapshot<Querysnapshot> snapshot) {
return Column(children: snapshot.map((e) => PostCard(post: e)).toList());
}