I get an error that "QuerySnapshot that has no instance of getter 'documentID'".
StreamBuilder(
stream: FirebaseFirestore.instance.collection("CHAT").orderBy("createdAt",descending: true).snapshots(),
builder: (ctx,AsyncSnapshot snapshot){
if(snapshot.connectionState==ConnectionState.waiting)
{
return Center(child: CircularProgressIndicator(color:Colors.green[300]));
}
else {
var doc=snapshot.data!.docs;
var user=FirebaseAuth.instance.currentUser;
return ListView.builder(
reverse: true,
itemCount: doc.length,
itemBuilder: (BuildContext ctx,index){
return BubbleMessage(
key: ValueKey(doc[index].documentID),
//:::::::::::::::get Message From firebase :::::::::::
message:doc[index]['message'],
//we check if the id isMe or the Other Person
isMe: doc[index]['userId']==user!.uid,
//::::::::::::::get username From Firebase ::::::::::::::::::
username: doc[index]['username'],
);
},
);
Why am I unable to access the documentID?
