registerStreamHandler<T extends Object, R> method
void
registerStreamHandler<T extends Object, R>(
- Stream<
R?> select(- T
- void handler(
- BuildContext context,
- AsyncSnapshot<
R?> newValue, - void cancel()
- R? initialValue,
- String? instanceName,
registers a handler
for a Stream
exactly once on the first build
and unregisters is when the widget is destroyed.
select
allows you to register the handler to a member of the of the Object
stored in GetIt. If the object itself if the Stream
pass (x)=>x
here
If you pass initialValue
your passed handler will be executes immediately
with that value
All handler get passed in a cancel
function that allows to kill the registration
from inside the handler.
Implementation
void registerStreamHandler<T extends Object, R>(
Stream<R?> Function(T) select,
void Function(BuildContext context, AsyncSnapshot<R?> newValue,
void Function() cancel)
handler, {
R? initialValue,
String? instanceName,
}) =>
_state.value.registerStreamHandler<T, R?>(select, handler,
initialValue: initialValue, instanceName: instanceName);