onRemoveListener method

RemoveListener onRemoveListener(
  1. void cb()
)

A life-cycle for whenever a listener is removed from the provider.

Returns a function which can be called to remove the listener.

See also:

Implementation

RemoveListener onRemoveListener(void Function() cb) {
  _throwIfInvalidUsage();

  final list = _onRemoveListeners ??= [];
  list.add(cb);

  return () => list.remove(cb);
}