LinkedEditSuggestion.fromJson constructor

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

Implementation

factory LinkedEditSuggestion.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    String value;
    if (json.containsKey('value')) {
      value = jsonDecoder.decodeString('$jsonPath.value', json['value']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'value');
    }
    LinkedEditSuggestionKind kind;
    if (json.containsKey('kind')) {
      kind = LinkedEditSuggestionKind.fromJson(
          jsonDecoder, '$jsonPath.kind', json['kind']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'kind');
    }
    return LinkedEditSuggestion(value, kind);
  } else {
    throw jsonDecoder.mismatch(jsonPath, 'LinkedEditSuggestion', json);
  }
}