Home > database >  WFlutter Firebase- Get only one field of data from firebase document
WFlutter Firebase- Get only one field of data from firebase document

Time:10-07

I have a collection of users and in each document, I want only to get on data which is the array, is there any possible way to only get on, or do I need the whole document?Picture of the firestore

CodePudding user response:

Try this please. Because its a field, as far as I know, we need to get the whole document first. Hope its help you.

 await Firestore.instance.collection('users').document(your document id)
        .get().then((Snapshot snapshot){
      print(snapshot.data['userCart'])
    });
  • Related