【发布时间】:2020-09-25 12:59:04
【问题描述】:
buildComments() {
return StreamBuilder(
stream: commentRef
.document(postId)
.collection('comments')
.orderBy('timestamp', descending: false)
.snapshots(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return circularProgress();
}
List<Comment> comments = [];
snapshot.data.documents.forEach((doc) {
print(comments);
comments.add(Comment.fromDocument(doc));
});
return ListView(
children: comments,
);
});
}
我试图在 list view.builder 中转换它,但它给了我错误你不能使用列表而不是小部件,任何人都可以解决这个问题。
【问题讨论】:
标签: firebase flutter dart google-cloud-firestore flutter-layout