KeymapHub class final

Program interceptor that owns a dynamic surface-first stack plus optional base layers.

final hub = KeymapHub();
hub.push(ShortcutSurface(
  id: 'session',
  bindings: [
    ShortcutBinding.chord(
      id: 'sidebar_toggle',
      leader: 'ctrl+x',
      key: 'b',
      description: 'toggle sidebar',
    ),
  ],
));

Order on onSend: top surface → … → bottom surface → base. Exclusive surfaces that pass drop the message.

Inheritance

Constructors

KeymapHub({List<ProgramInterceptor> base = const [], void onStackChanged()?, void onPendingChanged()?})
Creates a hub.

Properties

activeContinuations → List<ShortcutContinuation>
Continuation rows for the active pending sequence.
no setter
base → List<ProgramInterceptor>
Base interceptors (never popped by surface APIs).
no setter
hashCode → int
The hash code for this object.
no setterinherited
isSequencePending → bool
Whether any surface has a pending multi-key sequence.
no setter
onPendingChanged ↔ void Function()?
Invoked when any surface's pending sequence starts/clears.
getter/setter pair
onStackChanged ↔ void Function()?
Invoked after push/pop/replace/clear (for widget rebuilds).
getter/setter pair
pending → KeymapPendingSequence?
Pending multi-key sequence on the top surface (or any surface).
no setter
pendingPrefixLabel → String
Prefix label for which-key / footer (ctrl+x), or empty.
no setter
pendingStatusHint → String
Compact status hint while a sequence is pending (ctrl+x …).
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stack → List<ShortcutSurface>
Surface stack, bottom → top (top is last).
no setter
surfaceIds → List<String>
Ids of surfaces currently on the stack (bottom → top).
no setter
top → ShortcutSurface?
Top surface, if any.
no setter
topBindings → List<ShortcutBinding>
All bindings from the top surface (for shortcuts sheets).
no setter
wantsNativeFrames → bool
Whether this interceptor needs native cell snapshots after each render.
no setteroverride

Methods

activate(String id) → bool
Move an existing surface to the top without changing others' relative order.
activeShortcuts({bool includeReachable = false}) → List<ShortcutBinding>
Bindings for discovery UIs.
addBase(ProgramInterceptor interceptor) → void
Append a base interceptor (e.g. late-bound devtools).
addListener(void listener()) → void
Register a listener for stack or pending-sequence changes.
clearSurfaces() → void
Clear all surfaces (base remains).
contains(String id) → bool
Whether id is on the stack.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onProcessed(Msg msg, Duration elapsed) → void
Called after a message has been processed.
override
onRendered({required int renderGeneration, required Object view, required DegradationLevel degradationLevel, required Duration renderDuration, int? width, int? height, TerminalNativeFrame? nativeFrame, TerminalNativeDeltaFrame? nativeDelta, TerminalNativeCellDeltaFrame? nativeCellDelta, List<TerminalNativeSpanDelta>? nativeSpanDelta}) → void
Called after a render has completed.
override
onSend(Msg msg) → Msg?
Called for each message before it is queued.
override
onStart(void send(Msg msg)) → void
Called once after program initialization.
override
onStop() → void
Called during program cleanup.
override
pop([String? id]) → ShortcutSurface?
Remove the top surface, or the surface named id if given.
popUntil(String id) → void
Pop until id is top (removes layers above it).
push(ShortcutSurface surface) → void
Push surface as the new top.
removeListener(void listener()) → void
Remove a previously registered listener.
replace(ShortcutSurface surface) → void
Replace the surface with surface.id, or push if missing.
resetPending() → void
Cancel pending sequences on every surface.
toString() → String
A string representation of this object.
inherited

Operators

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