takeBytes method

Uint8List takeBytes()

Get bytes representation of this packer. Note: after this call do not reuse packer - create new.

Implementation

Uint8List takeBytes() {
  Uint8List bytes;
  if (_builder.isEmpty) {
    bytes = Uint8List.view(
      _buf.buffer,
      _buf.offsetInBytes,
      _offset,
    );
  } else {
    _flushBuf();
    bytes = _builder.takeBytes();
  }
  return bytes;
}