getOptionValues abstract method
Returns a list of values associated with a given option name.
Behavior:
- If the option is present without a value (
--flag
), returns an empty list[]
. - If the option has one value (
--name=John
), returns['John']
. - If the option has multiple values (
--name=John --name=Doe
), returns['John', 'Doe']
. - If the option is not present, returns
null
.
Example:
final names = args.getOptionValues('name');
if (names != null) {
print(names); // might print: ['Alice', 'Bob']
}
@param name the name of the option. @return list of values or null if the option is not present.
Implementation
List<String>? getOptionValues(String name);