Stream<T>.empty constructor

const Stream<T>.empty(
  1. {@Since("3.2") bool broadcast}

Creates an empty broadcast stream.

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


const stream = Stream.empty();
  (value) {
    throw "Unreachable";
  onDone: () {

The stream defaults to being a broadcast stream, as reported by isBroadcast. This value can be changed by passing false as the broadcast parameter, which defaults to true.

The stream can be listened to more than once, whether it reports itself as broadcast or not.


const factory Stream.empty({@Since("3.2") bool broadcast}) = _EmptyStream<T>;