FoldingRegion.fromJson constructor
FoldingRegion.fromJson(})
Implementation
factory FoldingRegion.fromJson(
JsonDecoder jsonDecoder,
String jsonPath,
Object? json, {
ClientUriConverter? clientUriConverter,
}) {
json ??= {};
if (json is Map) {
FoldingKind kind;
if (json.containsKey('kind')) {
kind = FoldingKind.fromJson(
jsonDecoder,
'$jsonPath.kind',
json['kind'],
clientUriConverter: clientUriConverter,
);
} else {
throw jsonDecoder.mismatch(jsonPath, 'kind');
}
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 FoldingRegion(kind, offset, length);
} else {
throw jsonDecoder.mismatch(jsonPath, 'FoldingRegion', json);
}
}