getPropertyAs<T> method

T? getPropertyAs<T>(
  1. String key,
  2. T? mapper(
    1. Object? v
    ), [
  3. T? def
])

Gets a property with key.

mapper Maps the value to T. def The default value if key not found.

Implementation

// ignore: use_function_type_syntax_for_parameters
T? getPropertyAs<T>(String key, T? mapper(Object? v), [T? def]) {
  var val = findKeyValue(_map, [key], true);
  return val != null ? mapper(val) : def;
}