skip to Main Content

The operator '[]' isn't defined for the class 'Iterable<dynamic>' – Flutter

[!Here is the code where i got an error, I could not use [] for this code return ListView.builder( reverse: true, itemCount: chatDocs?.length, itemBuilder: (ctx, index) => MessageBubble( chatDocs[index].data()['text'], chatDocs[index].data()['username'], chatDocs[index].data()['userImage'], chatDocs[index].data()['userId'] == user.uid, ), // Container( // padding: const…

VIEW QUESTION

This code is for Firestore but how I'll write this code for realtime database firebase in flutter?

Here I am trying to retrive data from realtime database in flutter Future<UserModel> getUserDrtails(String email) async{ final snapshot = await _db.collection("User").where("Email", isEqualTo: email).get(); final userData = snapshot.docs.map((e)=>UserModel.fromSnapshot(e)).single; return userData; } Here data is retrived from firestore database but I am…

VIEW QUESTION
Back To Top
Search