NavigationTarget.fromJson constructor
NavigationTarget.fromJson(})
Implementation
factory NavigationTarget.fromJson(
JsonDecoder jsonDecoder,
String jsonPath,
Object? json, {
ClientUriConverter? clientUriConverter,
}) {
json ??= {};
if (json is! Map) {
throw jsonDecoder.mismatch(jsonPath, "'NavigationTarget'", json);
}
ElementKind kind;
if (json case {'kind': var encodedKind}) {
kind = ElementKind.fromJson(
jsonDecoder,
'$jsonPath.kind',
encodedKind,
clientUriConverter: clientUriConverter,
);
} else {
throw jsonDecoder.mismatch(jsonPath, "'kind'", json);
}
int fileIndex;
if (json case {'fileIndex': var encodedFileIndex}) {
fileIndex = jsonDecoder.decodeInt(
'$jsonPath.fileIndex',
encodedFileIndex,
);
} else {
throw jsonDecoder.mismatch(jsonPath, "'fileIndex'", 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 startLine;
if (json case {'startLine': var encodedStartLine}) {
startLine = jsonDecoder.decodeInt(
'$jsonPath.startLine',
encodedStartLine,
);
} else {
throw jsonDecoder.mismatch(jsonPath, "'startLine'", json);
}
int startColumn;
if (json case {'startColumn': var encodedStartColumn}) {
startColumn = jsonDecoder.decodeInt(
'$jsonPath.startColumn',
encodedStartColumn,
);
} else {
throw jsonDecoder.mismatch(jsonPath, "'startColumn'", json);
}
int? codeOffset;
if (json case {'codeOffset': var encodedCodeOffset}) {
codeOffset = jsonDecoder.decodeInt(
'$jsonPath.codeOffset',
encodedCodeOffset,
);
}
int? codeLength;
if (json case {'codeLength': var encodedCodeLength}) {
codeLength = jsonDecoder.decodeInt(
'$jsonPath.codeLength',
encodedCodeLength,
);
}
return NavigationTarget(
kind,
fileIndex,
offset,
length,
startLine,
startColumn,
codeOffset: codeOffset,
codeLength: codeLength,
);
}