I have function like this. I need to get data from where query and need to use or but I have search there is no OR function so I have done like this.
List<Stream<QuerySnapshot>> getStreams() {
List<Stream<QuerySnapshot>> streams = [];
var firstQuery = FirebaseFirestore.instance
.collection(ROOM_COLLECTION)
.where('userId1', isEqualTo: globalProviderState.getID)
.snapshots();
var secondQuery = FirebaseFirestore.instance
.collection(ROOM_COLLECTION)
.where('userId2', isEqualTo: globalProviderState.getID)
.snapshots();
streams.add(firstQuery);
streams.add(secondQuery);
return streams;
}
And in StreamBuilder I am showing like this
StreamBuilder<QuerySnapshot>(
stream: getStreams(),
builder: (BuildContext context,
AsyncSnapshot<QuerySnapshot> snapshot) {
if (!snapshot.hasData) {
return new Text("Loading");
}
})
But its showing error that The argument type 'List<Stream<QuerySnapshot<Object?>>>' can't be assigned to the parameter type 'Stream<QuerySnapshot<Object?
I need to fix this error to get data in StreamBuilder