ExtractMethodFeedback.fromJson constructor
ExtractMethodFeedback.fromJson(})
Implementation
factory ExtractMethodFeedback.fromJson(
JsonDecoder jsonDecoder,
String jsonPath,
Object? json, {
ClientUriConverter? clientUriConverter,
}) {
json ??= {};
if (json is! Map) {
throw jsonDecoder.mismatch(jsonPath, "'extractMethod 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 returnType;
if (json case {'returnType': var encodedReturnType}) {
returnType = jsonDecoder.decodeString(
'$jsonPath.returnType',
encodedReturnType,
);
} else {
throw jsonDecoder.mismatch(jsonPath, "'returnType'", json);
}
List<String> names;
if (json case {'names': var encodedNames}) {
names = jsonDecoder.decodeList(
'$jsonPath.names',
encodedNames,
jsonDecoder.decodeString,
);
} else {
throw jsonDecoder.mismatch(jsonPath, "'names'", json);
}
bool canCreateGetter;
if (json case {'canCreateGetter': var encodedCanCreateGetter}) {
canCreateGetter = jsonDecoder.decodeBool(
'$jsonPath.canCreateGetter',
encodedCanCreateGetter,
);
} else {
throw jsonDecoder.mismatch(jsonPath, "'canCreateGetter'", json);
}
List<RefactoringMethodParameter> parameters;
if (json case {'parameters': var encodedParameters}) {
parameters = jsonDecoder.decodeList(
'$jsonPath.parameters',
encodedParameters,
(String jsonPath, Object? json) => RefactoringMethodParameter.fromJson(
jsonDecoder,
jsonPath,
json,
clientUriConverter: clientUriConverter,
),
);
} else {
throw jsonDecoder.mismatch(jsonPath, "'parameters'", json);
}
List<int> offsets;
if (json case {'offsets': var encodedOffsets}) {
offsets = jsonDecoder.decodeList(
'$jsonPath.offsets',
encodedOffsets,
jsonDecoder.decodeInt,
);
} else {
throw jsonDecoder.mismatch(jsonPath, "'offsets'", json);
}
List<int> lengths;
if (json case {'lengths': var encodedLengths}) {
lengths = jsonDecoder.decodeList(
'$jsonPath.lengths',
encodedLengths,
jsonDecoder.decodeInt,
);
} else {
throw jsonDecoder.mismatch(jsonPath, "'lengths'", json);
}
return ExtractMethodFeedback(
offset,
length,
returnType,
names,
canCreateGetter,
parameters,
offsets,
lengths,
);
}