Flutter : how i get data from firestore in List<String>?

3,126

Try using doc.data

listCour.add(doc.data);                   
Firestore.instance
    .collection('MATH')
    .document(doc.documentID)
    .collection("cours")
    .getDocuments()
    .then((QuerySnapshot snapshot) {
      snapshot.documents...
    })

Share:
3,126
Abdelmjid Asouab
Author by

Abdelmjid Asouab

Focusing 🧿🧿

Updated on December 10, 2022

Comments

  • Abdelmjid Asouab
    Abdelmjid Asouab over 1 year

    hi guys i'm trying to get data from my firestore database into List<String> for that i create variable List<String> listCour; and i use that instruction for get data from firestore

       Firestore.instance
        .collection('MATH')
        .document(doc.documentID)
        .collection("cours")
        .snapshots()
        .listen(
        (cour)=> cour.documents.forEach((doc){
    
               listCour.add(doc.documentID);                   
                 })
              );
    

    but the List has get no data !!

  • Abdelmjid Asouab
    Abdelmjid Asouab about 5 years
    no data :( i try any affection inside ` forEach((doc){ ---- } ` and didn't working i don't know why