toCommand method

Command<int> toCommand(
  1. String name
)

Converts this tool to a Command that can be added directly to a CommandRunner, therefore making it executable from the command-line.

The default implementation of this method returns a Command that calls run when it is executed.

This method can be overridden by subclasses to return a custom implementation/extension of DevToolCommand. class CustomTool extends DevTool { @override Command

class CustomCommand extends DevToolCommand {
  CustomCommand(String name, DevTool devTool) : super(name, devTool);

  @override
  String get usageFooter => 'Custom usage footer...';
}

Implementation

Command<int> toCommand(String name) => DevToolCommand(name, this);