addCommand method Null safety

  1. @override
ArgParser addCommand(
  1. String name,
  2. [ArgParser? parser]

Defines a command.

A command is a named argument which may in turn define its own options and subcommands using the given parser. If parser is omitted, implicitly creates a new one. Returns the parser for the command.

Note that adding commands this way will not impact the usage string. To add commands which are included in the usage string see CommandRunner.


ArgParser addCommand(String name, [ArgParser? parser]) {
  throw UnsupportedError(
      "ArgParser.allowAnything().addCommands() isn't supported.");