onChange method

VoidCallback onChange(
  1. void action(
    1. T value
    )
)

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);
}