moveNextArgument method

String? moveNextArgument()

Returns the next argument that is not a flag.

If matched, the argument is removed from the command input.

dart run example.dart build --release

In the above example, build is the next argument.

Implementation

String? moveNextArgument() {
  return switch (firstIndexWhere((element) => !element.startsWith('-'))) {
    int index => _internalArguments.removeAtOrNull(index),
    _ => null,
  };
}