parseWithType<T> method
Parses the first option in the command callback with type T
.
If the user has not yet provided a value for that option, null
is returned.
If no option of type T
is found, an exception is thrown.
You might also be interested in:
- parseNamed, for parsing an option by name.
Implementation
Future<T?> parseWithType<T>() => parseAllWithType<T>().firstWhere(
(element) => true,
orElse: () => throw CommandsException(
'No parameter with type $T found in command ${command.fullName}',
),
);