HighlightRegion.fromJson constructor
HighlightRegion.fromJson(})
Implementation
factory HighlightRegion.fromJson(
JsonDecoder jsonDecoder,
String jsonPath,
Object? json, {
ClientUriConverter? clientUriConverter,
}) {
json ??= {};
if (json is Map) {
HighlightRegionType type;
if (json.containsKey('type')) {
type = HighlightRegionType.fromJson(
jsonDecoder,
'$jsonPath.type',
json['type'],
clientUriConverter: clientUriConverter,
);
} else {
throw jsonDecoder.mismatch(jsonPath, 'type');
}
int offset;
if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'offset');
}
int length;
if (json.containsKey('length')) {
length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'length');
}
return HighlightRegion(type, offset, length);
} else {
throw jsonDecoder.mismatch(jsonPath, 'HighlightRegion', json);
}
}