Search code examples
firebaseflutterflutter-streambuilder

Flutter & firebase - StreamBuilder not loading


My code was working fine. As soon as I added isEqualTo, the app keeps on loading and loading.

I am guessing perhaps I do have to do something with RULES in FirebaseFirestore. Not sure though. And also I know nothing of rules.

StreamBuilder(
  stream: _firebaseFirestore
    .collection('wallpapers')
    .where('uploadedBy', isEqualTo: _user!.uid)
    .orderBy('date', descending: true)
    .snapshots(),
)

Solution

  • Inside your builder

    if (snapShot.hasError) {
      print(snapShot.error);
      return new Text('Error: ${snapShot.error}');
    }
    

    then it will probably print you the link in which you will be able to build your index with. If that's not the case make sure there exists a data that satisfies your query.