RenameFeedback.fromJson constructor

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

Implementation

factory RenameFeedback.fromJson(
  JsonDecoder jsonDecoder,
  String jsonPath,
  Object? json, {
  ClientUriConverter? clientUriConverter,
}) {
  json ??= {};
  if (json is! Map) {
    throw jsonDecoder.mismatch(jsonPath, "'rename feedback'", json);
  }
  int offset;
  if (json case {'offset': var encodedOffset}) {
    offset = jsonDecoder.decodeInt('$jsonPath.offset', encodedOffset);
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'offset'", json);
  }
  int length;
  if (json case {'length': var encodedLength}) {
    length = jsonDecoder.decodeInt('$jsonPath.length', encodedLength);
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'length'", json);
  }
  String elementKindName;
  if (json case {'elementKindName': var encodedElementKindName}) {
    elementKindName = jsonDecoder.decodeString(
      '$jsonPath.elementKindName',
      encodedElementKindName,
    );
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'elementKindName'", json);
  }
  String oldName;
  if (json case {'oldName': var encodedOldName}) {
    oldName = jsonDecoder.decodeString('$jsonPath.oldName', encodedOldName);
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'oldName'", json);
  }
  return RenameFeedback(offset, length, elementKindName, oldName);
}