AnalysisFoldingParams.fromJson constructor
AnalysisFoldingParams.fromJson(})
Implementation
factory AnalysisFoldingParams.fromJson(
JsonDecoder jsonDecoder,
String jsonPath,
Object? json, {
ClientUriConverter? clientUriConverter,
}) {
json ??= {};
if (json is! Map) {
throw jsonDecoder.mismatch(jsonPath, "'analysis.folding 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<FoldingRegion> regions;
if (json case {'regions': var encodedRegions}) {
regions = jsonDecoder.decodeList(
'$jsonPath.regions',
encodedRegions,
(String jsonPath, Object? json) => FoldingRegion.fromJson(
jsonDecoder,
jsonPath,
json,
clientUriConverter: clientUriConverter,
),
);
} else {
throw jsonDecoder.mismatch(jsonPath, "'regions'", json);
}
return AnalysisFoldingParams(file, regions);
}