off method

  1. @override
void off(
  1. String event,
  2. EventListener listener
)
override

Removes a specific listener from an event.

Removes the exact listener function from the specified event. Note: This requires the exact function reference to work properly.

event - The event name to remove the listener from listener - The specific listener function to remove

Implementation

@override
void off(String event, EventListener listener) {
  _listeners[event]?.removeWhere((reg) => reg.listener == listener);
  if (_listeners[event]?.isEmpty ?? false) {
    _listeners.remove(event);
  }
}