off<T, P> method

void off<T, P>(
  1. Object? instance,
  2. Enum eventName,
  3. CallbackEvent<T, P> callback
)

Removes the callback of eventName.

Implementation

void off<T, P>(
  Object? instance,
  Enum eventName,
  CallbackEvent<T, P> callback,
) {
  final notifier = _notifiers.lookup(ReactterNotifier(instance, eventName));
  notifier?.removeListener(callback);

  if (notifier != null && notifier.hasListeners == false) {
    notifier.dispose();
    _notifiers.remove(notifier);
  }
}