removeEventListener method

void removeEventListener(
  1. String type,
  2. Function listener
)
inherited

type - The type of the listener that gets removed.

listener - The listener function that gets removed.

Removes a listener from an event type.

Implementation

void removeEventListener(String type, Function listener) {
  if (_listeners == null) return;

  final listeners = _listeners!;
  final listenerArray = listeners[type];

  if (listenerArray != null) {
    final index = listenerArray.indexOf(listener);

    if (index != -1) {
      listenerArray.removeRange(index, index + 1);
    }
  }
}