concatWith method Null safety

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.


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


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

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