useOnStreamChange<T> function
StreamSubscription<T> ?
useOnStreamChange<T>(
- Stream<
T> ? stream, { - void onData(
- T event
- void onError(
- Object error,
- StackTrace stackTrace
- void onDone()?,
- bool? cancelOnError,
Subscribes to a Stream and calls the Stream.listen to register the onData
,
onError
, and onDone
.
Returns the StreamSubscription returned by the Stream.listen.
See also:
- Stream, the object listened.
- Stream.listen, calls the provided handlers.
Implementation
StreamSubscription<T>? useOnStreamChange<T>(
Stream<T>? stream, {
void Function(T event)? onData,
void Function(Object error, StackTrace stackTrace)? onError,
void Function()? onDone,
bool? cancelOnError,
}) {
return use<StreamSubscription<T>?>(
_OnStreamChangeHook<T>(
stream,
onData: onData,
onError: onError,
onDone: onDone,
cancelOnError: cancelOnError,
),
);
}