AnalysisNavigationParams.fromJson constructor
AnalysisNavigationParams.fromJson(})
Implementation
factory AnalysisNavigationParams.fromJson(
JsonDecoder jsonDecoder,
String jsonPath,
Object? json, {
ClientUriConverter? clientUriConverter,
}) {
json ??= {};
if (json is! Map) {
throw jsonDecoder.mismatch(
jsonPath,
"'analysis.navigation 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<NavigationRegion> regions;
if (json case {'regions': var encodedRegions}) {
regions = jsonDecoder.decodeList(
'$jsonPath.regions',
encodedRegions,
(String jsonPath, Object? json) => NavigationRegion.fromJson(
jsonDecoder,
jsonPath,
json,
clientUriConverter: clientUriConverter,
),
);
} else {
throw jsonDecoder.mismatch(jsonPath, "'regions'", json);
}
List<NavigationTarget> targets;
if (json case {'targets': var encodedTargets}) {
targets = jsonDecoder.decodeList(
'$jsonPath.targets',
encodedTargets,
(String jsonPath, Object? json) => NavigationTarget.fromJson(
jsonDecoder,
jsonPath,
json,
clientUriConverter: clientUriConverter,
),
);
} else {
throw jsonDecoder.mismatch(jsonPath, "'targets'", json);
}
List<String> files;
if (json case {'files': var encodedFiles}) {
files = jsonDecoder.decodeList(
'$jsonPath.files',
encodedFiles,
(String jsonPath, Object? json) =>
clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString(jsonPath, json),
) ??
jsonDecoder.decodeString(jsonPath, json),
);
} else {
throw jsonDecoder.mismatch(jsonPath, "'files'", json);
}
return AnalysisNavigationParams(file, regions, targets, files);
}