commands property

List<AppCommand> commands
final

App-wide commands: named actions that shortcuts, command palettes, agents, and tests can run on any screen.

Each command's AppCommand.shortcuts are bound at the app root and run it only while it is visible and enabled; otherwise the key passes on. While a presented dialog is on top, keys it doesn't handle stop at the dialog, so app shortcuts wait until it closes. Each visible command also appears as a command node under the app's semantic node, which an agent or test can activate. A shortcut or semantic activation runs the command with CommandContext.buildContext set to the focused widget's context when focus is inside the app, else to the active route's when there is one.

Ids must be unique within the list; a duplicate throws an ArgumentError. Commands contributed by FleuryAppExtensions follow these, and one with the same id as a command here is dropped. A CommandScope adds screen-level commands. A lookup by id from inside it, as a registry-backed command palette or CommandRegistry.command makes, finds the scope's command before an app command with the same id. The app's own shortcut and semantic node still run the app's command; a scope command bound to the same shortcut takes the key first, as a deeper binding does. Rebuilding with a new list replaces the commands.

Implementation

final List<AppCommand> commands;