Answers for "flutter firestore get document field"

0

flutter firestore get document field

final String _collection = 'collectionName';
final Firestore _fireStore = Firestore.instance;

getData() async {
  return await _fireStore.collection(_collection).getDocuments();
}

getData().then((val){
    if(val.documents.length > 0){
        print(val.documents[0].data["field"]);
    }
    else{
        print("Not Found");
    }
});
Posted by: Guest on July-30-2021

Code answers related to "flutter firestore get document field"

Browse Popular Code Answers by Language