removeEventListener method

  1. @override
void removeEventListener(
  1. dynamic state, {
  2. String? listenerId,
  3. Function? listener,
})
override

Implementation

@override
void removeEventListener(dynamic state, {String? listenerId, Function? listener}) {
  if (listenerId != null) {
    _listeners.removeWhere((item) => item.state == state && item.id == listenerId);
  } else if (listener != null) {
    for (int i = 0; i < _listeners.length; i++) {
      if (_listeners[i].state == state && _listeners[i].function == listener) {
        _listeners.removeAt(i);
        break;
      }
    }
  } else {
    _listeners.removeWhere((item) => item.state == state);
  }
}