AnalysisGetNavigationResult.fromJson constructor
AnalysisGetNavigationResult.fromJson(
- JsonDecoder jsonDecoder,
- String jsonPath,
- Object? json
)
Implementation
factory AnalysisGetNavigationResult.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json) {
json ??= {};
if (json is Map) {
List<String> files;
if (json.containsKey('files')) {
files = jsonDecoder.decodeList(
'$jsonPath.files', json['files'], jsonDecoder.decodeString);
} else {
throw jsonDecoder.mismatch(jsonPath, 'files');
}
List<NavigationTarget> targets;
if (json.containsKey('targets')) {
targets = jsonDecoder.decodeList(
'$jsonPath.targets',
json['targets'],
(String jsonPath, Object? json) =>
NavigationTarget.fromJson(jsonDecoder, jsonPath, json));
} else {
throw jsonDecoder.mismatch(jsonPath, 'targets');
}
List<NavigationRegion> regions;
if (json.containsKey('regions')) {
regions = jsonDecoder.decodeList(
'$jsonPath.regions',
json['regions'],
(String jsonPath, Object? json) =>
NavigationRegion.fromJson(jsonDecoder, jsonPath, json));
} else {
throw jsonDecoder.mismatch(jsonPath, 'regions');
}
return AnalysisGetNavigationResult(files, targets, regions);
} else {
throw jsonDecoder.mismatch(
jsonPath, 'analysis.getNavigation result', json);
}
}