concat<T> static method

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

Concatenates all of the specified stream sequences, as long as the previous stream sequence terminated successfully.

It does this by subscribing to each stream one by one, emitting all items and completing before subscribing to the next stream.

If the provided streams is empty, the resulting sequence completes immediately without emitting any items.

Interactive marble diagram

Example

Rx.concat([
  Stream.value(1),
  Rx.timer(2, Duration(days: 1)),
  Stream.value(3)
])
.listen(print); // prints 1, 2, 3

Implementation

static Stream<T> concat<T>(Iterable<Stream<T>> streams) =>
    ConcatStream<T>(streams);