DeferStream<T> constructor

DeferStream<T>(
  1. Stream<T> streamFactory(
      ),
    1. {bool reusable = false}
    )

    Constructs a Stream lazily, at the moment of subscription, using the streamFactory

    Implementation

    DeferStream(Stream<T> streamFactory(), {bool reusable = false})
        : _isReusable = reusable,
          _factory = reusable
              ? streamFactory
              : (() {
                  Stream<T> stream;
                  return () => stream ??= streamFactory();
                }());