OptionSpec class

The declared shape of one option: a flag (present or not, no value) or a value option (--name value, --name=value, -n value).

Every field that changes behavior is required and validated immediately, at construction: there is no default shape to fall back on.

Constructors

OptionSpec.flag(String name, {required String? abbr, required bool repeatable})
A flag: present or absent, never carries a value. Flags are never required (there is nothing to be "missing"; either it was read or not).
OptionSpec.value(String name, {required String? abbr, required bool required, required bool repeatable})
A value option: --name value, --name=value, or -n value (never -n=value, which is not a valid short form).

Properties

abbr → String?
The single-letter short name, matched as -x; null if this option has no short form.
final
hashCode → int
The hash code for this object.
no setteroverride
name → String
The long name, matched as --name.
final
repeatable → bool
Whether the option may occur more than once on the same invocation.
final
required → bool
Whether the option must be present for the route to resolve. Checked only once, after every other option on the invocation has been read.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
takesValue → bool
true for a value option, false for a flag.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
Two OptionSpecs are the same option when they have the same shape: same name, abbr, takesValue, required and repeatable. This is declared-shape equality, not Dart's default reference identity, so two separately constructed OptionSpecs that describe the same option (e.g. one registered on a route and again, identically, on a route reachable through its own parameter chain) are recognized as one option throughout resolution, not as two unrelated ones (spec 8.2).
override