CallbackExecutor class

Callback-based command executor.

Convenient way to create executors from function callbacks without creating a full class.

Inheritance

Constructors

CallbackExecutor({required Future<ItemResult> onExecute(CommandContext context, CliArgs args), Future<ToolResult> onExecuteWithoutTraversal(CliArgs args)?})

Properties

handlesListMode → bool
Whether this executor has its own --list mode (CliArgs.listOnly): it then lists what it would work on, writes nothing and runs no process. ToolRunner calls such an executor under --list; every other executor is replaced by a stand-in that names the project and runs nothing, so --list never runs a command.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
onExecute → Future<ItemResult> Function(CommandContext context, CliArgs args)
Callback executed for each folder.
final
onExecuteWithoutTraversal → Future<ToolResult> Function(CliArgs args)?
Callback for non-traversal execution.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

afterTraversal(List<ItemResult> results, CliArgs args) → Future<ItemResult?>
Called once after the traversal of this executor's command, with the results execute returned for the projects it visited, in visit order. An executor that sums up over projects (a report table, a total) writes that here; per-project output stays in execute.
inherited
execute(CommandContext context, CliArgs args) → Future<ItemResult>
Execute command on a single folder.
override
executeWithoutTraversal(CliArgs args) → Future<ToolResult>
Execute command without traversal.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pubCachePreflight(CommandContext context, {String? pubCachePath}) → ItemResult?
A failure ItemResult when context's project locks packages the pub cache cannot supply, or null when it can supply them all.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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