cancel static method

KeyBindings cancel({
  1. void onCancel()?,
  2. String hintLabel = 'Esc',
  3. String hintDescription = 'cancel',
})

Creates cancel bindings (Esc and Ctrl+C).

Implementation

static KeyBindings cancel({
  void Function()? onCancel,
  String hintLabel = 'Esc',
  String hintDescription = 'cancel',
}) {
  return KeyBindings([
    KeyBinding.multi(
      {KeyEventType.esc, KeyEventType.ctrlC},
      (event) {
        onCancel?.call();
        return KeyActionResult.cancelled;
      },
      hintLabel: hintLabel,
      hintDescription: hintDescription,
    ),
  ]);
}