Occurrences.fromJson constructor
Occurrences.fromJson(})
Implementation
factory Occurrences.fromJson(
JsonDecoder jsonDecoder,
String jsonPath,
Object? json, {
ClientUriConverter? clientUriConverter,
}) {
json ??= {};
if (json is Map) {
Element element;
if (json.containsKey('element')) {
element = Element.fromJson(
jsonDecoder,
'$jsonPath.element',
json['element'],
clientUriConverter: clientUriConverter,
);
} else {
throw jsonDecoder.mismatch(jsonPath, 'element');
}
List<int> offsets;
if (json.containsKey('offsets')) {
offsets = jsonDecoder.decodeList(
'$jsonPath.offsets',
json['offsets'],
jsonDecoder.decodeInt,
);
} else {
throw jsonDecoder.mismatch(jsonPath, 'offsets');
}
int length;
if (json.containsKey('length')) {
length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'length');
}
return Occurrences(element, offsets, length);
} else {
throw jsonDecoder.mismatch(jsonPath, 'Occurrences', json);
}
}