registerNativeByteBacking function

void registerNativeByteBacking(
  1. Uint8List bytes,
  2. Pointer<Uint8> pointer,
  3. Finalizable owner
)

Registers the native allocation that backs bytes.

Called only by the FFI buffer helper after it attaches the allocation's finalizer. Slices created through NativeByteView.slice inherit it.

Implementation

void registerNativeByteBacking(
  Uint8List bytes,
  ffi.Pointer<ffi.Uint8> pointer,
  ffi.Finalizable owner,
) {
  final backing = _NativeByteBacking(pointer, owner, bytes.offsetInBytes);
  _nativeByteBackings[bytes] = backing;
  _nativeBufferBackings[bytes.buffer] = backing;
}