concatWith method

Stream<T> concatWith (
  1. Iterable<Stream<T>> other
)

Returns a Stream that emits all items from the current Stream, then emits all items from the given streams, one after the next.

Example

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

Implementation

Stream<T> concatWith(Iterable<Stream<T>> other) {
  final concatStream = ConcatStream<T>([this, ...other]);

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