0

I'm trying to retrieve data from Firebase collection and I'm able to do it partially. I'm only be able to retrieve the data which I manually inputted in the database. I'm not able to retrieve data which has been entered using the 'set()' method.

I have tried using StreamBuilder as well but the result is the same.

This is what my database looks like

Only these are being printed and have been entered manually by me

These are being omitted and have been added using set()

This is how I'm retrieving from the database

initialize() async {

/*    var u = await FirebaseFirestore.instance.collection('users').get();
    var v = u.docs.toString();
    print(v);
    */

  CollectionReference ref  =  FirebaseFirestore.instance.collection('users');
  QuerySnapshot users = await ref.get();
  print(users.size);

  HashMap<String, Profile> data = new HashMap<String, Profile>();
  List <Profile> da = [];

  for (DocumentSnapshot document in users.docs) {

    print(document.id);
    CollectionReference profile = document.reference.collection('profile');
    var required = await profile.doc('required').get();
    //print(required.get('name'));

  }

This is what is being printed

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • The document IDs that are shown in italics are not actually documents, but just shown as placeholders because there are subcollections under that path. Since there are no documents for those items, they are **not** included when you get all user documents from the database. – Frank van Puffelen Jul 26 '23 at 14:22

0 Answers0