controlBytes property

Uint8List get controlBytes

The original immutable control bytes, with an independent view owner. Application spans remain separate and are not copied or flattened.

Implementation

Uint8List get controlBytes {
  _handle.check();
  final api = _handle.api;
  final id = api._control(_handle.id);
  _check(id);
  late final int capacity;
  late final int length;
  try {
    final info = api.owner._getInfoId(id);
    capacity = info.capacity;
    length = info.length;
  } catch (_) {
    api.owner._release(id);
    rethrow;
  }
  final buffer = NativeOwnedBuffer._(
    _OwnedHandle(api.owner, id, externalSize: capacity),
    length,
    0,
    0,
  );
  try {
    return buffer.bytes;
  } finally {
    buffer.dispose();
  }
}