getDataAsTypedMap<T, R> method

Map<T, R> getDataAsTypedMap<T, R>({
  1. required T toTypedKey(
    1. String
    ),
  2. R toTypedValue(
    1. dynamic
    )?,
})

Return raw (unwrapped) object data as Map<String, R> where R is not of type JsonNode but a dart StandardType (String, bool, etc).

Implementation

Map<T, R> getDataAsTypedMap<T, R>({
  required T Function(String) toTypedKey,
  R Function(dynamic)? toTypedValue,
}) =>
    data.map((key, value) => MapEntry(toTypedKey.call(key),
        toTypedValue?.call(value.data) ?? value.data as R));