snapshot.data.documents[][]
Widget build(BuildContext context) {
return Scaffold(
body: StreamBuilder(
stream:Firestore.instance.collection('chats/wuQaqmmo64XVBVJ6S6ET/messages')
.snapshots()
,builder: (ctx,snapshot) {
if(snapshot.connectionState == ConnectionState.waiting){
return Center(
child: CircularProgressIndicator(),
);
}
return ListView.builder(
itemCount: 5,
itemBuilder: (ctx, index) =>
Container(
padding: EdgeInsets.all(8)
, child: Text(snapshot.data.documents[0]['text']),
),
);
}
This is showing an error --The property 'documents' can't be unconditionally accessed because the receiver can be 'null'. And there is no any property of documents in flutter now?