length property

int length

Current written length.

It's acceptable to mutate the length temporarily to write into a specific region of the buffer.

Decreasing length does not affect the underlying buffer at all.

Increasing length does not guarantee that the added bytes are zero. For increasing length with zero bytes, use writeZeroes.

Implementation

int get length => _length;
void length=(int value)

Implementation

set length(int value) {
  final oldValue = this._length;
  if (value > oldValue) {
    ensureAvailableLength(value - oldValue);
  }
  this._length = value;
}