Command<T> class Null safety

A single command.

A command is known as a "leaf command" if it has no subcommands and is meant to be run. Leaf commands must override run.

A command with subcommands is known as a "branch command" and cannot be run itself. It should call addSubcommand (often from the constructor) to register subcommands.

Constructors

Command()

Properties

aliases List<String>
Alternate names for this command.
read-only
argParser ArgParser
The argument parser for this command.
read-only
argResults ArgResults?
The parsed argument results for this command.
read-only
category String
The command's category.
read-only
description String
A description of this command, included in usage.
read-only
globalResults ArgResults?
The parsed global argument results.
read-only
hashCode int
The hash code for this object.
read-only, inherited
hidden bool
Whether or not this command should be hidden from help listings.
read-only
invocation String
A single-line template for how to invoke this command (e.g. "pub getpackage").
read-only
name String
The name of this command.
read-only
parent Command<T>?
The command's parent command, if this is a subcommand.
read-only
runner CommandRunner<T>?
The command runner for this command.
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
subcommands Map<String, Command<T>>
An unmodifiable view of all sublevel commands of this command.
read-only
summary String
A short description of this command, included in parent's CommandRunner.usage.
read-only
takesArguments bool
Whether or not this command takes positional arguments in addition to options.
read-only
usage String
Generates a string displaying usage information for this command.
read-only
usageFooter String?
An optional footer for usage.
read-only

Methods

addSubcommand(Command<T> command) → void
Adds Command as a subcommand of this.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
printUsage() → void
Prints the usage information for this command.
run() FutureOr<T>?
Runs this command.
toString() String
A string representation of this object.
inherited
usageException(String message) → Never
Throws a UsageException with message.

Operators

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