parseCursor function
Simple guard that validates a change cursor string can be interpreted as an integer sequence value. Persistent journals use monotonically increasing integers for ordering, so the helper is shared between implementations.
Implementation
int parseCursor(String cursor) {
final sequence = int.tryParse(cursor);
if (sequence == null || sequence <= 0) {
throw RpcDataError.invalidArgument('Cursor $cursor is not valid.');
}
return sequence;
}