SearchFindElementReferencesParams.fromJson constructor

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

Implementation

factory SearchFindElementReferencesParams.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    String file;
    if (json.containsKey('file')) {
      file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'file');
    }
    int offset;
    if (json.containsKey('offset')) {
      offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'offset');
    }
    bool includePotential;
    if (json.containsKey('includePotential')) {
      includePotential = jsonDecoder.decodeBool(
          '$jsonPath.includePotential', json['includePotential']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'includePotential');
    }
    return SearchFindElementReferencesParams(file, offset, includePotential);
  } else {
    throw jsonDecoder.mismatch(
        jsonPath, 'search.findElementReferences params', json);
  }
}