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) {
  final stream = MergeStream<T>([this, ...streams]);

  return isBroadcast ? stream.asBroadcastStream() : stream;
}