RenameFeedback.fromJson constructor

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

Implementation

factory RenameFeedback.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    int offset;
    if (json.containsKey('offset')) {
      offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'offset');
    }
    int length;
    if (json.containsKey('length')) {
      length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'length');
    }
    String elementKindName;
    if (json.containsKey('elementKindName')) {
      elementKindName = jsonDecoder.decodeString(
          '$jsonPath.elementKindName', json['elementKindName']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'elementKindName');
    }
    String oldName;
    if (json.containsKey('oldName')) {
      oldName =
          jsonDecoder.decodeString('$jsonPath.oldName', json['oldName']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'oldName');
    }
    return RenameFeedback(offset, length, elementKindName, oldName);
  } else {
    throw jsonDecoder.mismatch(jsonPath, 'rename feedback', json);
  }
}