0

i am working on a To Do app so i have a firebase databse where i store all the tasks added by the person (expired, completed and ongoing are in the same collection), so on my active task screen i want to filter out the tasks that have expired and those that have been completed, so i wrote it in my stream bnuilder as

 StreamBuilder<QuerySnapshot>(
                  builder: (context, snapshot) {
                    if (!snapshot.hasData)
                      return Container(
                        height: constraints.maxHeight * 0.7,
                        child: Center(
                          child: Text('press the + icon to add a task'),
                        ),
                      );
                    return Expanded(child: _buildList(snapshot.data));
                  },
                  stream: FirebaseFirestore.instance
                      .collection(user.email)
                      .where('completed', isEqualTo: false)
                      .where('expired', isEqualTo: false)
                      .orderBy('DOC', descending: false)
                      .snapshots(),
                ),

i can't say it doesn't work because when i try it without my data on it works perfectly fine but as soon as i turn on my data, the stream won't return any snapshots, (and yes the data gets added to firebase) also when i hot reload or restart or add a task for a split second i see it then it just disappears

but if i remove the orderBy and leave both where's it works data on or off and vice versa if i remove the where's and leave just the orderBy it works data on or off, just one where and one orderBy doesn't work too

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807

0 Answers0