【发布时间】:2021-07-04 23:36:45
【问题描述】:
我正在尝试使用从 firebase 查询的数据构建列表视图。但是我有一个错误'参数类型'List
Widget buildComments() {
if (this.didFetchComments == false) {
return FutureBuilder<List<CommentData>>(
future: commentService.getComments(),
builder: (context, snapshot) {
if (!snapshot.hasData)
return Container(
alignment: FractionalOffset.center,
child: CircularProgressIndicator());
this.didFetchComments = true;
this.fetchedComments = snapshot.data;
return ListView(
children: snapshot.data, // where i'm having error
);
});
} else {
return ListView(children: this.fetchedComments);
}
}
我该如何解决这个问题..
【问题讨论】:
标签: firebase flutter flutter-listview