mergeWith method

Stream<T> mergeWith (
  1. Iterable<Stream<T>> streams
)

Combines the items emitted by multiple streams into a single stream of items. The items are emitted in the order they are emitted by their sources.

Example

TimerStream(1, Duration(seconds: 10))
    .mergeWith([Stream.fromIterable([2])])
    .listen(print); // prints 2, 1

Implementation

Stream<T> mergeWith(Iterable<Stream<T>> streams) =>
    transform(StreamTransformer.fromBind(
        (stream) => MergeStream<T>([stream, ...streams])));