EditGetRefactoringParams.fromJson constructor
EditGetRefactoringParams.fromJson(})
Implementation
factory EditGetRefactoringParams.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
RefactoringKind kind;
if (json.containsKey('kind')) {
kind = RefactoringKind.fromJson(
jsonDecoder, '$jsonPath.kind', json['kind'],
clientUriConverter: clientUriConverter);
} else {
throw jsonDecoder.mismatch(jsonPath, 'kind');
}
String file;
if (json.containsKey('file')) {
file = clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString('$jsonPath.file', json['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');
}
int length;
if (json.containsKey('length')) {
length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'length');
}
bool validateOnly;
if (json.containsKey('validateOnly')) {
validateOnly = jsonDecoder.decodeBool(
'$jsonPath.validateOnly', json['validateOnly']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'validateOnly');
}
RefactoringOptions? options;
if (json.containsKey('options')) {
options = RefactoringOptions.fromJson(
jsonDecoder, '$jsonPath.options', json['options'], kind,
clientUriConverter: clientUriConverter);
}
return EditGetRefactoringParams(kind, file, offset, length, validateOnly,
options: options);
} else {
throw jsonDecoder.mismatch(jsonPath, 'edit.getRefactoring params', json);
}
}