compact method

  1. @override
bool compact()
override

Compact the internal bytes capacity to length.

Implementation

@override
bool compact() {
  if (_length < _bytes.length) {
    _bytes = _bytes.sublist(0, _length);
    bytesData = ByteDataIntCodec(_bytes.asByteData());
    return true;
  }
  return false;
}