AnalysisErrorsParams.fromJson constructor
AnalysisErrorsParams.fromJson(})
Implementation
factory AnalysisErrorsParams.fromJson(
JsonDecoder jsonDecoder,
String jsonPath,
Object? json, {
ClientUriConverter? clientUriConverter,
}) {
json ??= {};
if (json is! Map) {
throw jsonDecoder.mismatch(jsonPath, "'analysis.errors params'", json);
}
String file;
if (json case {'file': var encodedFile}) {
file =
clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString('$jsonPath.file', encodedFile),
) ??
jsonDecoder.decodeString('$jsonPath.file', encodedFile);
} else {
throw jsonDecoder.mismatch(jsonPath, "'file'", json);
}
List<AnalysisError> errors;
if (json case {'errors': var encodedErrors}) {
errors = jsonDecoder.decodeList(
'$jsonPath.errors',
encodedErrors,
(String jsonPath, Object? json) => AnalysisError.fromJson(
jsonDecoder,
jsonPath,
json,
clientUriConverter: clientUriConverter,
),
);
} else {
throw jsonDecoder.mismatch(jsonPath, "'errors'", json);
}
return AnalysisErrorsParams(file, errors);
}