IncludedSuggestionRelevanceTag.fromJson constructor

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

Implementation

factory IncludedSuggestionRelevanceTag.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    String tag;
    if (json.containsKey('tag')) {
      tag = jsonDecoder.decodeString('$jsonPath.tag', json['tag']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'tag');
    }
    int relevanceBoost;
    if (json.containsKey('relevanceBoost')) {
      relevanceBoost = jsonDecoder.decodeInt(
          '$jsonPath.relevanceBoost', json['relevanceBoost']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'relevanceBoost');
    }
    return IncludedSuggestionRelevanceTag(tag, relevanceBoost);
  } else {
    throw jsonDecoder.mismatch(
        jsonPath, 'IncludedSuggestionRelevanceTag', json);
  }
}