combineLatest<T, R> static method

Stream<R> combineLatest<T, R>(
  1. Iterable<Stream<T>> streams,
  2. R combiner(
    1. List<T> values
    )
)

Merges the given Streams into a single Stream sequence by using the combiner function whenever any of the stream sequences emits an item. This is helpful when you need to combine a dynamic number of Streams.

The Stream will not emit any lists of values until all of the source streams have emitted at least one value.

If the provided streams is empty, the resulting sequence completes immediately without emitting any items and without any calls to the combiner function.

Interactive marble diagram

Example

Rx.combineLatest([ Stream.value('a'), Stream.fromIterable('b', 'c', 'd') ], (list) => list.join()) .listen(print); // prints 'ab', 'ac', 'ad'

Implementation

static Stream<R> combineLatest<T, R>(
        Iterable<Stream<T>> streams, R Function(List<T> values) combiner) =>
    CombineLatestStream<T, R>(streams, combiner);