registerHandler<T extends Object, R> method
void
registerHandler<T extends Object, R>(
- ValueListenable<
R> select(- T
- void handler(
- BuildContext context,
- R newValue,
- void cancel()
- bool executeImmediately = false,
- String? instanceName,
registers a handler
for a ValueListenable
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 ValueListenable
pass (x)=>x
here
If you set executeImmediately
to true
the handler will be called immediately
with the current value of the ValueListenable
.
All handler get passed in a cancel
function that allows to kill the registration
from inside the handler.
Implementation
void registerHandler<T extends Object, R>(
ValueListenable<R> Function(T) select,
void Function(BuildContext context, R newValue, void Function() cancel)
handler, {
bool executeImmediately = false,
String? instanceName,
}) =>
widget._state.value.registerHandler<T, R>(select, handler,
instanceName: instanceName, executeImmediately: executeImmediately);