onChange method
Registers a callback to be invoked whenever the ValueNotifier
's value changes.
Implementation
VoidCallback onChange(void Function(T value) action) {
void listener() => action(_value);
addListener(listener);
return () => removeListener(listener);
}