merge<T> method Null safety

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

Merges the events from streams into a single single-subscription stream.

This is equivalent to adding streams to a group, closing that group, and returning its stream.

Implementation

static Stream<T> merge<T>(Iterable<Stream<T>> streams) {
  var group = StreamGroup<T>();
  streams.forEach(group.add);
  group.close();
  return group.stream;
}