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