off method

void off(
  1. String event, [
  2. EventHandler? handler
])

Implementation

void off(String event, [EventHandler? handler]) {
  if (handler != null) {
    _events[event]?.remove(handler);
    _eventsOnce[event]?.remove(handler);
    if (_events[event]?.isEmpty == true) {
      _events.remove(event);
    }
    if (_eventsOnce[event]?.isEmpty == true) {
      _eventsOnce.remove(event);
    }
  } else {
    _events.remove(event);
    _eventsOnce.remove(event);
  }
}