I can't find documentation or example how to use multiple where clauses in Flutter Stream Builder returned by Firestore Collection.
The bellow query works
Firestore
.instance
.collection (collectionName)
.where ("index", arrayContains: search)
.orderBy ('date', descending: true )
.snapshots()
but return zero if I add an additional where clause
Firestore
.instance
.collection (collectionName)
.where ("index", arrayContains: search)
.where ('allowed_roles', arrayContains: GlobalVars.userRole.toString() )
.orderBy ('date', descending: true )
.snapshots()
The compound query examples in Firebase documentation look pretty much as above but there is missing Flutter or Dart examples.
EDITED :
I have also tried the query build pattern as workaround but it doesn't work neither. Flutter really doesn't want the arrayContains clause more than once.
CollectionReference collectionRef = Firestore.instance.collection (collectionName);
Query p = collectionRef.where ('allowed_roles', arrayContains: "3");
Query q = p.where ('index', arrayContains: "Dan");
Stream s = q.snapshots();
What I am missing here is what solution should programmer use for this problem a logical AND is a pretty basic equation and it is unusual to stuck on this feature.