getFromJsonToGenericFn function
dynamic
getFromJsonToGenericFn()
Resolves the matching fromJson function for the provided generic type ids.
Implementation
dynamic getFromJsonToGenericFn(
Map<List<String>, dynamic Function(Map<String, dynamic>)> fns,
Map<String, dynamic> json,
List<String> genericType,
) {
var types = genericType.map((e) => json[e]).toList();
var fromJsonToGeneric_fn = fns.entries
.firstWhereOrNull((entry) => ListEquality().equals(entry.key, types))
?.value;
if (fromJsonToGeneric_fn == null) //
throw Exception("From JSON function not found");
return fromJsonToGeneric_fn;
}