off<P> method

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

Removes the callback of eventName event.

Implementation

void off<P>(Enum eventName, CallbackEvent<T, P> callback) {
  _events[_instanceReceived]?[eventName]?.remove(callback);

  if (_events[_instanceReceived]?[eventName]?.isEmpty ?? false) {
    _events[_instanceReceived]?.remove(eventName);
  }

  if (_events[_instanceReceived]?.isEmpty ?? false) {
    _events.remove(_instanceReceived);
  }
}