property<T> method

T? property<T>(
  1. String key, [
  2. T? def,
  3. TypeElementParser? parser
])

Implementation

T? property<T>(String key, [T? def, TypeElementParser? parser]) {
  var value = _properties[key];

  if (value == null) {
    var keyLC = normalizeKey(key);
    value = _properties[keyLC];
  }

  if (value == null) return def;

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