stringArg method

String? stringArg(
  1. String label
)

One argument with surrounding string quotes stripped — the common case of a string-literal configuration value.

Implementation

String? stringArg(String label) {
  final source = args[label]?.trim();
  if (source == null) {
    return null;
  }
  final quoted = (source.startsWith("'") && source.endsWith("'")) ||
      (source.startsWith('"') && source.endsWith('"'));
  return quoted && source.length >= 2
      ? source.substring(1, source.length - 1)
      : source;
}