off<T> method

bool off<T>({
  1. String? type,
  2. EventCallback<T>? callback,
})

Remove an attached listener, by event type, data type and callback...

Implementation

bool off<T>({String? type, EventCallback<T>? callback}) {
  bool removed = false;
  for (final listener in listeners.toList()) {
    if (listener.protected) continue;
    if (listener.matches(type, callback)) {
      removed = removeEventListener(listener) || removed;
    }
  }
  return removed;
}