removeListener method

AsyncEventEmitter removeListener(
  1. String event,
  2. Handler listener
)

Removes the given event listener. @param event The event for which to remove a listener. @param listener The listener to remove. @returns A reference to the event emitter such that calls can be chained.

Implementation

AsyncEventEmitter removeListener(String event, Handler<dynamic> listener) {
  final listeners = _getListeners(event);
  final index = listeners.indexOf(listener);
  if (index != -1) {
    listeners.splice(index, 1);
  }
  return this;
}