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.


TimerStream(1, Duration(seconds: 10))
    .listen(print); // prints 2, 1


Stream<T> mergeWith(Iterable<Stream<T>> streams) {
  final stream = MergeStream<T>([this, ...streams]);

  return isBroadcast
      ? stream.asBroadcastStream(onCancel: (s) => s.cancel())
      : stream;