UsingStream<T, R> constructor

UsingStream<T, R>({
  1. required FutureOr<R> resourceFactory(),
  2. required Stream<T> streamFactory(
    1. R
    ),
  3. required FutureOr<void> disposer(
    1. R
    ),
})

Construct a UsingStream that creates a resource object from resourceFactory, and then creates a Stream from streamFactory and resource as argument. When the Stream terminates, call disposer on resource object.

Implementation

UsingStream({
  required FutureOr<R> Function() resourceFactory,
  required Stream<T> Function(R) streamFactory,
  required FutureOr<void> Function(R) disposer,
}) : super(_buildStream(resourceFactory, streamFactory, disposer));