Defines the contract for accessing and parsing command-line arguments passed to an application.
This interface allows inspection of raw arguments, detection of option-based arguments
(like --name=value
), and separation of non-option arguments.
Example usage:
class MyAppArgs implements ApplicationArguments {
final List<String> _args;
MyAppArgs(this._args);
@override
List<String> getSourceArgs() => _args;
@override
Set<String> getOptionNames() => {...};
@override
bool containsOption(String name) => {...};
@override
List<String> getOptionValues(String name) => {...};
@override
List<String> getNonOptionArgs() => [...];
}
This is typically used during application startup to parse user-supplied flags and parameters, especially in CLI-based or microservice setups.
- Implementers
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
containsOption(
String name) → bool - Checks whether a given option name is present in the parsed arguments.
-
getNonOptionArgs(
) → List< String> -
Returns all non-option arguments (those without
--
prefix). -
getOptionNames(
) → Set< String> - Returns the names of all parsed option arguments.
-
getOptionValues(
String name) → List< String> ? - Returns a list of values associated with a given option name.
-
getPackageName(
) → String -
Represents an abstraction for identifying the package that an object,
resource, or service belongs to.
inherited
-
getSourceArgs(
) → List< String> - Returns the raw unprocessed arguments passed to the application.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited