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) {
    throw jsonDecoder.mismatch(jsonPath, "'LinkedEditSuggestion'", json);
  }
  String value;
  if (json case {'value': var encodedValue}) {
    value = jsonDecoder.decodeString('$jsonPath.value', encodedValue);
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'value'", json);
  }
  LinkedEditSuggestionKind kind;
  if (json case {'kind': var encodedKind}) {
    kind = LinkedEditSuggestionKind.fromJson(
      jsonDecoder,
      '$jsonPath.kind',
      encodedKind,
      clientUriConverter: clientUriConverter,
    );
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'kind'", json);
  }
  return LinkedEditSuggestion(value, kind);
}