ShortcutBinding class final

A named action bound to a key sequence of length ≥ 1.

ShortcutBinding.single(
  id: 'command_list',
  key: 'ctrl+p',
  description: 'commands',
);
ShortcutBinding.chord(
  id: 'sidebar_toggle',
  leader: 'ctrl+x',
  key: 'b',
  description: 'toggle sidebar',
  group: 'session',
);
ShortcutBinding.help(); // ? → help_show

Constructors

ShortcutBinding({required String id, required List<String> keys, String description = '', String group = 'Commands', List<String>? displayKeys})
const
ShortcutBinding.chord({required String id, required String leader, required String key, String description = '', String group = 'Commands'})
Two-key leader chord (OpenCode-style ctrl+x then letter).
factory
ShortcutBinding.fromChord(KeyChordBinding chord)
Bridge from a KeyChordBinding.
factory
ShortcutBinding.help({String key = '?', String id = shortcutHelpActionId, String description = 'show shortcuts', String group = 'Help'})
Binding that opens the shortcuts sheet (? by default).
factory
ShortcutBinding.single({required String id, required String key, String description = '', String group = 'Commands', String? displayKey})
Single-key shortcut.
factory

Properties

continuationLabel → String
Last-step key label.
no setter
description → String
Human-readable action description.
final
displayKeys → List<String>?
Optional display labels per step (defaults to keys).
final
formattedKeys → String
Display string for the full path (ctrl+x b or ctrl+p).
no setter
group → String
Help / which-key group label.
final
hashCode → int
The hash code for this object.
no setteroverride
id → String
Stable action id (e.g. sidebar_toggle, OpenCode keybind names).
final
isSequence → bool
Whether this is a multi-key sequence.
no setter
keys → List<String>
Ordered key specs (ctrl+x, b, …). Length 1 = single; 2+ = sequence.
final
labels → List<String>
Labels for UI (which-key, sheets).
no setter
prefixLabel → String
First-step key label (leader or single).
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

matchesStep(Key key, int index) → bool
Whether key matches sequence step index.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toChordBinding() → KeyChordBinding?
Bridge to KeyChordBinding when keys has length 2.
toKeyBinding() → KeyBinding
Convert to a help KeyBinding for single-key entries / HelpView adapters.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
override