exitOn static method

KeyBindings exitOn({
  1. required Set<KeyEventType> keys,
  2. void onExit()?,
  3. String? hintLabel,
  4. String? hintDescription,
})

Creates bindings that exit on any of the specified keys.

Useful for "press Enter to continue" or "press any key" scenarios.

Implementation

static KeyBindings exitOn({
  required Set<KeyEventType> keys,
  void Function()? onExit,
  String? hintLabel,
  String? hintDescription,
}) {
  return KeyBindings([
    KeyBinding.multi(
      keys,
      (event) {
        onExit?.call();
        return KeyActionResult.confirmed;
      },
      hintLabel: hintLabel,
      hintDescription: hintDescription,
    ),
  ]);
}