Position.fromJson constructor
Position.fromJson(})
Implementation
factory Position.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
String file;
if (json.containsKey('file')) {
file = clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString('$jsonPath.file', json['file'])) ??
jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'file');
}
int offset;
if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'offset');
}
return Position(file, offset);
} else {
throw jsonDecoder.mismatch(jsonPath, 'Position', json);
}
}