asList<T> function
Converts the value at key to a List.
Implementation
List<T> asList<T>(dynamic json, String key,
{T Function(dynamic json)? fromJson}) {
return asListOrNull(json, key, fromJson: fromJson) ??
(throw FormatException('Invalid List<$T> value for key: $key'));
}