dispatch method

bool dispatch(
  1. KeyEvent event
)

Dispatches event to matching handlers.

Returns true when at least one handler matched. The current handler list is copied before dispatch, so handlers can safely mutate bindings without affecting the in-flight dispatch.

Implementation

bool dispatch(KeyEvent event) {
  final handlers = _handlers[event.binding];
  if (handlers == null || handlers.isEmpty) return false;

  for (final handler in List<KeyHandler>.from(handlers)) {
    handler(event);
  }
  return true;
}