IncludedSuggestionSet.fromJson constructor

IncludedSuggestionSet.fromJson(
  1. JsonDecoder jsonDecoder,
  2. String jsonPath,
  3. Object? json
)

Implementation

factory IncludedSuggestionSet.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');
    }
    int relevance;
    if (json.containsKey('relevance')) {
      relevance =
          jsonDecoder.decodeInt('$jsonPath.relevance', json['relevance']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'relevance');
    }
    String? displayUri;
    if (json.containsKey('displayUri')) {
      displayUri = jsonDecoder.decodeString(
          '$jsonPath.displayUri', json['displayUri']);
    }
    return IncludedSuggestionSet(id, relevance, displayUri: displayUri);
  } else {
    throw jsonDecoder.mismatch(jsonPath, 'IncludedSuggestionSet', json);
  }
}