nativeBackingPointer function

Pointer<Uint8>? nativeBackingPointer(
  1. Uint8List bytes
)

Looks up the native pointer for bytes when they still have provenance.

Implementation

ffi.Pointer<ffi.Uint8>? nativeBackingPointer(Uint8List bytes) {
  final backing =
      _nativeByteBackings[bytes] ?? _nativeBufferBackings[bytes.buffer];
  if (backing == null) return null;
  final offset = bytes.offsetInBytes - backing.rootOffset;
  return backing.pointer + offset;
}