LinkedEditSuggestion.fromJson constructor

LinkedEditSuggestion.fromJson(
  1. JsonDecoder jsonDecoder,
  2. String jsonPath,
  3. Object? json, {
  4. ClientUriConverter? clientUriConverter,
})

Implementation

factory LinkedEditSuggestion.fromJson(
  JsonDecoder jsonDecoder,
  String jsonPath,
  Object? json, {
  ClientUriConverter? clientUriConverter,
}) {
  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'],
        clientUriConverter: clientUriConverter,
      );
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'kind');
    }
    return LinkedEditSuggestion(value, kind);
  } else {
    throw jsonDecoder.mismatch(jsonPath, 'LinkedEditSuggestion', json);
  }
}