activeShortcuts method

List<ShortcutBinding> activeShortcuts({
  1. bool includeReachable = false,
})

Bindings for discovery UIs.

By default only the top surface. When includeReachable is true and the top surface is not exclusive, also includes lower surfaces until an exclusive layer is hit (bottom-up accumulate, top first).

Implementation

List<ShortcutBinding> activeShortcuts({bool includeReachable = false}) {
  if (_stack.isEmpty) return const [];
  if (!includeReachable) {
    return List.unmodifiable(top!.bindings);
  }

  final out = <ShortcutBinding>[];
  final seen = <String>{};
  for (var i = _stack.length - 1; i >= 0; i--) {
    final surface = _stack[i];
    for (final b in surface.bindings) {
      if (seen.add(b.id)) out.add(b);
    }
    if (surface.exclusive) break;
  }
  return List.unmodifiable(out);
}