parseWithType<T> method

Future<T?> parseWithType<T>()

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:

Implementation

Future<T?> parseWithType<T>() => parseAllWithType<T>().firstWhere(
      (element) => true,
      orElse: () => throw CommandsException(
        'No parameter with type $T found in command ${command.fullName}',
      ),
    );