handle method

Cmd? handle(
  1. KeyMsg msg
)

Returns the command from the first matching handler, or null.

Iterates shortHelp calling KeyBinding.activate on each. Returns the first non-null result. If no binding matches, or none have a handler registered, returns null.

This is the primary entry point for dispatch:

final cmd = keyMap.handle(msg);
if (cmd != null) return (this, cmd);

Implementation

Cmd? handle(KeyMsg msg) {
  for (final binding in shortHelp) {
    final cmd = binding.activate(msg);
    if (cmd != null) return cmd;
  }
  return null;
}