asListString function

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

Returns a List for the value at key. Throws a FormatException if the value is not a list of strings.

Implementation

List<String> asListString(dynamic json, String key,
    {String Function(dynamic json)? fromJson}) {
  return asListStringOrNull(json, key, fromJson: fromJson) ??
      (throw FormatException('Invalid List<String> value for key: $key'));
}