Combine streams from Firestore in flutter

The last example should work. Perhaps the 2nd stream didn't emit any values during the time you observed the stream.

StreamGroup.merge() from the async package should also work.

StreamZip creates pairs of values one of each stream. When they emit values at a different rate, then one stream waits with emitting until the other emits a value. This is probably not what you want.


Use CombineLatestStream from rxdart to combine streams.

The StreamBuilder will build every time one of the streams emits a new event.

The result snapshot.data is a list of the latest element per stream.

Example:

StreamBuilder(
stream: CombineLatestStream.list([
  stream0,
  stream1,
]),
builder: (context, snapshot) {
  final data0 = snapshot.data[0];
  final data1 = snapshot.data[1];
})