我想将集合内容打印到listbuilder
我的围巾式正文代码直接在将来的生成器上插入了Firestore读取查询
body: new Container(
decoration: BoxDecoration(
color: Colors.white10
),
child: playlistsRef.document().collection('usersPlaylists').getDocuments() == null
? Center(
child: new CircularProgressIndicator(
valueColor: new AlwaysStoppedAnimation<Color>(Colors.white
),
strokeWidth: 3.0,
),
)
: FutureBuilder(
future: playlistsRef.document().collection('usersPlaylists').getDocuments(),
builder: (context, snapshot) {
return ListView.builder(
itemCount: snapshot.data.documents.length,
itemBuilder: (BuildContext context, int index) {
Playlist playlist = Playlist.fromDoc(snapshot.data.documents[index]);
return _buildPlaylistTile(playlist);
},
);
},
),
),
),
和最终播放列表Ref = _firestore.collection('playlists');在常量dart文件中
因为它不具有initState
并且代码不起作用并返回错误:在null上调用了getter'documents'
如何解决此错误并正确打印文档