Flag<T> class

A flag is the base representation of a property given at the command line.

It is intended to be extended for every special use case to deliver formatting and parsing.

As example you should extend the class Flag, for a command line flag representing a platform target formatted as system_processor. Then you can hide the Flag member variables and you have to provide a formating and parsing function.

Implementers

Constructors

Flag({required String name, required T value, required String format(T value), required T parse(String raw), List<T> examples = const [], String description = ""})

Properties

description String
Description of the flag, explaining the purpose of the property.
final
examples List<T>
The flags example values done for guiding.
final
format String Function(T value)
Formats the flags value into a string, that can be parsed by the Flag's parse function.
final
hashCode int
The hash code for this object.
no setteroverride
name String
The name of the flag, that have to be referenced when typing in the command line.
final
parse → T Function(String raw)
Parses a string into the flags value type. Returns the parsed value.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value ↔ T
The mutable reference to the flags value.
getter/setter pair

Methods

getExamplesFormatted() List<String>
Returns the flag example values as formatted strings. If the examples are empty an empty list is returned.
getFormatted() String
Returns the flags value as a formatted string.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setParsed(String raw) → void
Sets the parsed raw value as the flags one.
syntaxString() String
Syntax message part describing the flag.
toString() String
A string representation of this object.
override

Operators

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