merge method

Stream<T> merge(
  1. Stream<T> other
)

Merges values and errors from this stream and other in any order as they arrive.

The result stream will not close until both this stream and other have closed.

For example:

final result = source.merge(other);

source:  1--2-----3--|
other:   ------4-------5--|
result:  1--2--4--3----5--|

If this stream is a broadcast stream, the result stream will be as well, regardless of other's type. If a single subscription stream is merged into a broadcast stream it may never be canceled since there may be broadcast listeners added later.

If a broadcast stream is merged into a single-subscription stream any events emitted by other before the result stream has a subscriber will be discarded.

Implementation

Stream<T> merge(Stream<T> other) => mergeAll([other]);