getJsonList<T> function
Implementation
List<T> getJsonList<T>(
Map<String, dynamic> json,
String key,
) {
final List<dynamic> list = getJsonValue(json, key);
T mapper(it) {
if (it is T) {
return it;
} else {
throw SchemeConsistencyException(
'Wrong type by key "$key", expected: "List<$T>" '
'but has got element in list of type: "${it.runtimeType}"',
);
}
}
return list.isEmpty ? <T>[] : list.map(mapper).toList();
}