2

In my code,

 Stream<List<Reminder>> getReminders() {
    return _db.collection('reminders').where('subject',isEqualTo: "SCM").orderBy('due',descending: true).snapshots().map((snapshot) => snapshot
        .docs
        .map((document) => Reminder.fromFirestore(document.data()))
        .toList());
  }

When I use where or orderBy separately, I can see the list is reactive, whenever I change something in Firestore, reflects immediately in the App in realtime. If I combine them like above, the app doesn't react to the change in realtime. What am I doing wrong?

Thanks.

  • Any valid combination of `where` and `orderBy` should be able to get realtime results. Without seeing everything you're doing to reproduce the issue, it's hard to tell what's wrong. – Doug Stevenson Oct 21 '20 at 21:26
  • 1
    This is suppose to be the error your not reading: ```Stream error: [cloud_firestore/failed-precondition] The query requires an index. You can create it here:...```. Check this issue https://stackoverflow.com/questions/53790175/why-does-this-firestore-query-require-an-index – Raine Dale Holgado Oct 22 '20 at 00:13

0 Answers0