mapOf<V> function

Map<String, V> mapOf<V>(
  1. dynamic json,
  2. V valueMappingOp(
    1. dynamic json
    )
)

Implementation

Map<String, V> mapOf<V>(dynamic json, V Function(dynamic json) valueMappingOp) {
  final map = <String, V>{};
  if (json is Map && json.isNotEmpty) {
    json = json.cast<String, dynamic>(); // ignore: parameter_assignments
    for (final entry in json.entries) {
      final value = valueMappingOp(entry.value);
      if (value != null) {
        map[entry.key] = value;
      }
    }
  }
  return map;
}