asList<T> function

List<T> asList<T>(
  1. dynamic json,
  2. String key, {
  3. T fromJson(
    1. dynamic json
    )?,
})

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'));
}