Real CLI parsing uses a package, but a tiny --flag value reader is just a for-loop over an argument list. Each pair fills a Map<String, String>, then the program reads it with safe defaults.

Program

Play the program to parse a fixed argument list into a small options map.

argument_parser_lite.dart
void main() {
  var args = ['--name', 'Ada', '--count', '3'];
  var options = <String, String>{};
  for (var i = 0; i + 1 < args.length; i += 2) {
    var key = args[i].substring(2);
    options[key] = args[i + 1];
  }
  var name = options['name'] ?? '';
  var count = int.parse(options['count'] ?? '0');
  print('$name x$count');
}
flag pairs Each `--flag value` pair becomes one entry in the options map, keyed by the flag name.
substring(2) `args[i].substring(2)` drops the leading `--` from each flag before storing it.
safe defaults `options['count'] ?? '0'` falls back to a sensible string when the flag is missing.