Stream<T>.empty constructor Null safety

const Stream<T>.empty()

Creates an empty broadcast stream.

This is a stream which does nothing except sending a done event when it's listened to.

Example:

const stream = Stream.empty();
stream.listen(
  (value) {
    throw "Unreachable";
  },
  onDone: () {
    print('Done');
  },
);

Implementation

const factory Stream.empty() = _EmptyStream<T>;