NavigationTarget.fromJson constructor
NavigationTarget.fromJson(
- JsonDecoder jsonDecoder,
- String jsonPath,
- Object? json
)
Implementation
factory NavigationTarget.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json) {
json ??= {};
if (json is Map) {
ElementKind kind;
if (json.containsKey('kind')) {
kind =
ElementKind.fromJson(jsonDecoder, '$jsonPath.kind', json['kind']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'kind');
}
int fileIndex;
if (json.containsKey('fileIndex')) {
fileIndex =
jsonDecoder.decodeInt('$jsonPath.fileIndex', json['fileIndex']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'fileIndex');
}
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');
}
int startLine;
if (json.containsKey('startLine')) {
startLine =
jsonDecoder.decodeInt('$jsonPath.startLine', json['startLine']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'startLine');
}
int startColumn;
if (json.containsKey('startColumn')) {
startColumn =
jsonDecoder.decodeInt('$jsonPath.startColumn', json['startColumn']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'startColumn');
}
int? codeOffset;
if (json.containsKey('codeOffset')) {
codeOffset =
jsonDecoder.decodeInt('$jsonPath.codeOffset', json['codeOffset']);
}
int? codeLength;
if (json.containsKey('codeLength')) {
codeLength =
jsonDecoder.decodeInt('$jsonPath.codeLength', json['codeLength']);
}
return NavigationTarget(
kind, fileIndex, offset, length, startLine, startColumn,
codeOffset: codeOffset, codeLength: codeLength);
} else {
throw jsonDecoder.mismatch(jsonPath, 'NavigationTarget', json);
}
}