useStreamController function - flutter_hooks library (original) (raw)
Creates a StreamController which is automatically disposed when necessary.
See also:
- StreamController, the created object
- useStream, to listen to the created StreamController
Implementation
StreamController<T> useStreamController<T>({
bool sync = false,
VoidCallback? onListen,
VoidCallback? onCancel,
List<Object?>? keys,
}) {
return use(
_StreamControllerHook(
onCancel: onCancel,
onListen: onListen,
sync: sync,
keys: keys,
),
);
}