Effect<Value>.streamTask constructor
Effect<Value>.streamTask (
- Stream<
Value> stream(), { - Value onDone()?,
- Value onError(
- Object error,
- StackTrace stackTrace
- bool cancelOnError = true,
Lazily constructs and subscribes to a stream returned by stream each
time the effect runs. Useful when each invocation requires a new stream
subscription.
Example:
final socketEffect = Effect.streamTask(() => socket.connect());
Implementation
factory Effect.streamTask(
Stream<Value> Function() stream, {
Value Function()? onDone,
Value Function(Object error, StackTrace stackTrace)? onError,
bool cancelOnError = true,
}) =>
Effect.stream(
stream: stream(),
onDone: onDone,
onError: onError,
cancelOnError: cancelOnError,
);