withLatestFromList method
Creates an Observable that emits when the source stream emits, combining the latest values from the streams into a list. This is helpful when you need to combine a dynamic number of Streams.
If any of latestFromStreams has not emitted any values, this stream will not emit either.
Example
Observable.fromIterable([1, 2]).withLatestFromList(
[
Observable.fromIterable([2, 3]),
Observable.fromIterable([3, 4]),
Observable.fromIterable([4, 5]),
Observable.fromIterable([5, 6]),
Observable.fromIterable([6, 7]),
],
).listen(print); // print [2, 2, 3, 4, 5, 6] (due to the async nature of streams)
Implementation
Observable<List<T>> withLatestFromList(
Iterable<Stream<T>> latestFromStreams) =>
transform(WithLatestFromStreamTransformer.withList(latestFromStreams));