简体   繁体   中英

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

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 !!

Try using doc.data

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM