position method

dynamic position([
  1. int? newPosition
])

Sets or gets this buffer's position

Implementation

dynamic position([int? newPosition]) {
  if (newPosition == null) {
    return _pos;
  }
  if (newPosition < 0 || newPosition > _buf.length) {
    throw RangeError(
        'Invalid position, position: $newPosition, length: ${_buf.length}');
  }
  _pos = newPosition;
  return this;
}