removeListener method

  1. @mustCallSuper
void removeListener(
  1. String eventName,
  2. Function callback
)

Implementation

@mustCallSuper
void removeListener(String eventName, Function callback) {
  assert(callback != null);
  assert(eventName != null);
  assert(eventName.isNotEmpty);

  if (!_events.containsKey(eventName)) {
    return;
  }

  _events[eventName]!.removeWhere((listener) => listener.fn == callback);

  if (_events[eventName]!.isEmpty) {
    _events.remove(eventName);
  }
}