Outline.fromJson constructor
Outline.fromJson(})
Implementation
factory Outline.fromJson(
JsonDecoder jsonDecoder,
String jsonPath,
Object? json, {
ClientUriConverter? clientUriConverter,
}) {
json ??= {};
if (json is! Map) {
throw jsonDecoder.mismatch(jsonPath, "'Outline'", json);
}
Element element;
if (json case {'element': var encodedElement}) {
element = Element.fromJson(
jsonDecoder,
'$jsonPath.element',
encodedElement,
clientUriConverter: clientUriConverter,
);
} else {
throw jsonDecoder.mismatch(jsonPath, "'element'", 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);
}
int codeOffset;
if (json case {'codeOffset': var encodedCodeOffset}) {
codeOffset = jsonDecoder.decodeInt(
'$jsonPath.codeOffset',
encodedCodeOffset,
);
} else {
throw jsonDecoder.mismatch(jsonPath, "'codeOffset'", json);
}
int codeLength;
if (json case {'codeLength': var encodedCodeLength}) {
codeLength = jsonDecoder.decodeInt(
'$jsonPath.codeLength',
encodedCodeLength,
);
} else {
throw jsonDecoder.mismatch(jsonPath, "'codeLength'", json);
}
List<Outline>? children;
if (json case {'children': var encodedChildren}) {
children = jsonDecoder.decodeList(
'$jsonPath.children',
encodedChildren,
(String jsonPath, Object? json) => Outline.fromJson(
jsonDecoder,
jsonPath,
json,
clientUriConverter: clientUriConverter,
),
);
}
return Outline(
element,
offset,
length,
codeOffset,
codeLength,
children: children,
);
}