LazyStream<T> constructor

LazyStream<T>(FutureOr<Stream<T>> callback())

Creates a single-subscription Stream that calls callback when it gets a listener and forwards to the returned stream.

Implementation

LazyStream(FutureOr<Stream<T>> callback()) : _callback = callback {
  // Explicitly check for null because we null out [_callback] internally.
  if (_callback == null) throw new ArgumentError.notNull('callback');
}