extract<T> function

T? extract<T>(
  1. String key,
  2. Map<String, dynamic>? properties, {
  3. T? defaultValue,
})

Implementation

T? extract<T>(String key, Map<String, dynamic>? properties, {T? defaultValue}) {
  var result = defaultValue;
  if (properties == null) {
    return result;
  }
  for (final entry in properties.entries) {
    // not sure if this comparison is actually necessary,
    // but existed in the old destination so ...
    if (key.toLowerCase() == entry.key.toLowerCase()) {
      result = entry.value;
    }
  }

  return result;
}