AnalysisHighlightsParams.fromJson constructor
AnalysisHighlightsParams.fromJson(})
Implementation
factory AnalysisHighlightsParams.fromJson(
JsonDecoder jsonDecoder,
String jsonPath,
Object? json, {
ClientUriConverter? clientUriConverter,
}) {
json ??= {};
if (json is Map) {
String file;
if (json.containsKey('file')) {
file =
clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString('$jsonPath.file', json['file']),
) ??
jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'file');
}
List<HighlightRegion> regions;
if (json.containsKey('regions')) {
regions = jsonDecoder.decodeList(
'$jsonPath.regions',
json['regions'],
(String jsonPath, Object? json) => HighlightRegion.fromJson(
jsonDecoder,
jsonPath,
json,
clientUriConverter: clientUriConverter,
),
);
} else {
throw jsonDecoder.mismatch(jsonPath, 'regions');
}
return AnalysisHighlightsParams(file, regions);
} else {
throw jsonDecoder.mismatch(jsonPath, 'analysis.highlights params', json);
}
}