argument<T> method

T? argument<T>(
  1. int index, [
  2. T? def,
  3. TypeElementParser? parser
])

Implementation

T? argument<T>(int index, [T? def, TypeElementParser? parser]) {
  if (index >= _arguments.length) return def;
  var value = _arguments[index];

  parser ??= TypeParser.parserFor<T>(obj: def);
  if (parser != null) {
    return parser(value) as T;
  } else {
    return value as T;
  }
}