AvailableSuggestionSet.fromJson constructor
AvailableSuggestionSet.fromJson(
- JsonDecoder jsonDecoder,
- String jsonPath,
- Object? json
)
Implementation
factory AvailableSuggestionSet.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json) {
json ??= {};
if (json is Map) {
int id;
if (json.containsKey('id')) {
id = jsonDecoder.decodeInt('$jsonPath.id', json['id']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'id');
}
String uri;
if (json.containsKey('uri')) {
uri = jsonDecoder.decodeString('$jsonPath.uri', json['uri']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'uri');
}
List<AvailableSuggestion> items;
if (json.containsKey('items')) {
items = jsonDecoder.decodeList(
'$jsonPath.items',
json['items'],
(String jsonPath, Object? json) =>
AvailableSuggestion.fromJson(jsonDecoder, jsonPath, json));
} else {
throw jsonDecoder.mismatch(jsonPath, 'items');
}
return AvailableSuggestionSet(id, uri, items);
} else {
throw jsonDecoder.mismatch(jsonPath, 'AvailableSuggestionSet', json);
}
}