ArgsSimple class

Available extensions

Constructors

ArgsSimple()
ArgsSimple.fromEncodedJson(String encodedJson)
factory
ArgsSimple.fromJson(Object json)
Creates an ArgsSimple from a JSON value:
factory
ArgsSimple.parse([List<String> args = const <String>[]])
Parses command-line args:

Properties

arguments → List<String>
no setter
flags → Set<String>
no setter
hashCode → int
The hash code for this object.
no setterinherited
isEmpty → bool
no setter
isNotEmpty → bool
no setter
options → Map<String, Object>
no setter
properties → Map<String, Object>
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addArgument(String value) → void
addFlag(String key) → void
Adds the flag key (normalized with normalizeKey).
argument<T>(int index, [T? def, TypeElementParser? parser]) → T?
argumentAsBool(int index, [bool? def]) → bool?
argumentAsDirectory(int index, [Directory? def]) → Directory?

Available on ArgsSimple, provided by the ArgsSimpleExtension extension

argumentAsDouble(int index, [double? def]) → double?
argumentAsFile(int index, [File? def]) → File?

Available on ArgsSimple, provided by the ArgsSimpleExtension extension

argumentAsFileContentBytes(int index, [File? def]) → Uint8List?

Available on ArgsSimple, provided by the ArgsSimpleExtension extension

argumentAsFileContentJSON(int index, [File? def]) → dynamic

Available on ArgsSimple, provided by the ArgsSimpleExtension extension

argumentAsFileContentString(int index, [File? def]) → String?

Available on ArgsSimple, provided by the ArgsSimpleExtension extension

argumentAsFileContentYAML(int index, [File? def]) → dynamic

Available on ArgsSimple, provided by the ArgsSimpleExtension extension

argumentAsInt(int index, [int? def]) → int?
argumentAsList(int index, [List? def]) → List?
argumentAsMap(int index, [Map? def]) → Map?
argumentAsSet(int index, [Set? def]) → Set?
argumentAsString(int index, [String? def]) → String?
argumentMatches(int index, Pattern pattern) → bool
flag<T>(String key) → bool
flagOr<T>(String key, bool? def) → bool?
loadEnvironment() → Set<String>

Available on ArgsSimple, provided by the ArgsSimpleExtension extension

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
option<T>(String key, [T? def, TypeElementParser? parser]) → T?
optionAsBool(String key, [bool? def]) → bool?
optionAsDirectory(String key, [Directory? def]) → Directory?

Available on ArgsSimple, provided by the ArgsSimpleExtension extension

optionAsDouble(String key, [double? def]) → double?
optionAsFile(String key, [File? def]) → File?

Available on ArgsSimple, provided by the ArgsSimpleExtension extension

optionAsFileContentBytes(String key, [File? def]) → Uint8List?

Available on ArgsSimple, provided by the ArgsSimpleExtension extension

optionAsFileContentJSON(String key, [File? def]) → dynamic

Available on ArgsSimple, provided by the ArgsSimpleExtension extension

optionAsFileContentString(String key, [File? def]) → String?

Available on ArgsSimple, provided by the ArgsSimpleExtension extension

optionAsFileContentYAML(String key, [File? def]) → dynamic

Available on ArgsSimple, provided by the ArgsSimpleExtension extension

optionAsInt(String key, [int? def]) → int?
optionAsList(String key, [List? def]) → List?
optionAsMap(String key, [Map? def]) → Map?
optionAsSet(String key, [Set? def]) → Set?
optionAsString(String key, [String? def]) → String?
optionMatches(String key, Pattern pattern) → bool
property<T>(String key, [T? def, TypeElementParser? parser]) → T?
propertyAsBool(String key, [bool? def]) → bool?
propertyAsDirectory(String key, [Directory? def]) → Directory?

Available on ArgsSimple, provided by the ArgsSimpleExtension extension

propertyAsDouble(String key, [double? def]) → double?
propertyAsFile(String key, [File? def]) → File?

Available on ArgsSimple, provided by the ArgsSimpleExtension extension

propertyAsFileContentBytes(String key, [File? def]) → Uint8List?

Available on ArgsSimple, provided by the ArgsSimpleExtension extension

propertyAsFileContentJSON(String key, [File? def]) → dynamic

Available on ArgsSimple, provided by the ArgsSimpleExtension extension

propertyAsFileContentString(String key, [File? def]) → String?

Available on ArgsSimple, provided by the ArgsSimpleExtension extension

propertyAsFileContentYAML(String key, [File? def]) → dynamic

Available on ArgsSimple, provided by the ArgsSimpleExtension extension

propertyAsInt(String key, [int? def]) → int?
propertyAsList(String key, [List? def]) → List?
propertyAsMap(String key, [Map? def]) → Map?
propertyAsSet(String key, [Set? def]) → Set?
propertyAsString(String key, [String? def]) → String?
propertyMatches(String key, Pattern pattern) → bool
putOption(String key, Object value) → void
putProperty(String key, Object value) → void
toJson() → Map<String, Object>
Returns a JSON-encodable copy: arguments and flags as Lists, options and properties as Maps (empty sections are omitted). See ArgsSimple.fromJson.
toList() → List<String>
Serializes back to a command line that ArgsSimple.parse parses to the same arguments, flags, options and properties.
toString() → String
A string representation of this object.
override

Operators

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

Static Methods

normalizeKey(String key) → String
Normalizes a flag, option or property key, making keys case-insensitive and insensitive to separators (--sys-config, --sys_config and --SysConfig are the same key):