ChordController class
Owns chord definitions and the live pending-chord snapshot.
final chords = ChordController(bindings: [
tui.KeyChordBinding.simple(
id: 'toggle-sidebar',
leader: 'ctrl+x',
key: 'b',
description: 'toggle sidebar',
),
]);
// main.dart
interceptor: chords.interceptor
// app
ChordHost(controller: chords, onResolved: handleId, child: ...)
// anywhere in the tree
final c = ChordController.of(context);
if (c.isActive) WhichKeySlot()
- Inheritance
-
- Object
- ChangeNotifier
- ChordController
Constructors
-
ChordController({required List<
KeyChordBinding> bindings, Duration? timeout, ProgramInterceptor? innerInterceptor})
Properties
-
bindings
→ List<
KeyChordBinding> -
All configured bindings (definition source of truth).
no setter
- continuationKeysLabel → String
-
Space-separated continuation key labels (
b l m t …).no setter -
entries
→ List<
WhichKeyEntry> -
Continuation entries for the active prefix (empty when idle).
no setter
- generation → int
-
Bumps whenever pending state changes (for ChordScope notify).
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- interceptor → ProgramInterceptor
-
Program interceptor derived from the same bindings.
no setter
- isActive → bool
-
Whether a leader/prefix chord is pending.
no setter
- keyChordInterceptor → KeyChordInterceptor
-
Underlying interceptor (same instance as interceptor).
no setter
- prefix → Key?
-
Active prefix key, if any.
no setter
- prefixLabel → String
-
Human-readable prefix (from binding help, e.g.
ctrl+x).no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- statusHint → String
-
Compact status-row hint while pending (e.g.
ctrl+x …).no setter - timeout → Duration?
-
How long the interceptor waits for a continuation key (
null= forever).final
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
applyMessage(
Msg msg) → String? - Apply a chord / keymap lifecycle message from the program loop.
-
dispose(
) → void -
Discards any resources used by the object.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
whichKeyBanner(
{String title = 'which-key'}) → String - Banner-friendly line for which-key chrome.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
isChordMessage(
Msg msg) → bool -
Whether
msgis a chord/keymap lifecycle message this controller understands. -
maybeOf(
BuildContext context) → ChordController? -
Nearest ChordController from the tree, or
null. -
of(
BuildContext context) → ChordController - Nearest ChordController; asserts if missing.