HighlightRegion.fromJson constructor
HighlightRegion.fromJson(})
Implementation
factory HighlightRegion.fromJson(
JsonDecoder jsonDecoder,
String jsonPath,
Object? json, {
ClientUriConverter? clientUriConverter,
}) {
json ??= {};
if (json is! Map) {
throw jsonDecoder.mismatch(jsonPath, "'HighlightRegion'", json);
}
HighlightRegionType type;
if (json case {'type': var encodedType}) {
type = HighlightRegionType.fromJson(
jsonDecoder,
'$jsonPath.type',
encodedType,
clientUriConverter: clientUriConverter,
);
} else {
throw jsonDecoder.mismatch(jsonPath, "'type'", json);
}
int offset;
if (json case {'offset': var encodedOffset}) {
offset = jsonDecoder.decodeInt('$jsonPath.offset', encodedOffset);
} else {
throw jsonDecoder.mismatch(jsonPath, "'offset'", json);
}
int length;
if (json case {'length': var encodedLength}) {
length = jsonDecoder.decodeInt('$jsonPath.length', encodedLength);
} else {
throw jsonDecoder.mismatch(jsonPath, "'length'", json);
}
return HighlightRegion(type, offset, length);
}