getOffset method

int getOffset()

Returns the current offset value.

This method throws an assertion error if called on the initial position. Always check isInitial before calling:

if (!pos.isInitial()) {
  print(pos.getOffset());
}

Implementation

int getOffset() {
  assert(_offset >= 0, "Offset cannot be negative. When using initial, always check isInitial() first.");
  return _offset;
}