infrastructure/native/bindings/ffi_buffer_helper
library
Functions
-
attachAdoptedNativePayload(AdoptedNativePayload payload)
→ Uint8List
-
Rebuilds a zero-copy view for a payload adopted from another isolate.
-
callWithBuffer(BufferCallback fn, {int? maxSize, int? initialSize, bool preferTransient = false, bool? allowZeroCopy})
→ Uint8List?
-
Calls a buffer callback function with dynamically sized buffers.
-
detachZeroCopyPayload(Uint8List bytes)
→ AdoptedNativePayload?
-
Detaches a zero-copy malloc so another isolate can adopt it.
-
materializeFfiBytes(Pointer<Uint8> buf, int length, {required bool transferOwnership, required bool allowZeroCopy})
→ Uint8List
-
Materializes FFI bytes using the same zero-copy policy as callWithBuffer.
-
preferTransientFfiBufferForParams(Uint8List params)
→ bool
-
When true, skip the reusable scratch pool so large sync param queries can
return zero-copy result views without an extra scratch→owned copy.
-
releaseAdoptedNativePayload(AdoptedNativePayload payload)
→ void
-
Frees an adopted payload that was never attached on the receiving isolate.
-
resetTransientFfiBufferPoolForTest()
→ void
-
Frees pooled transient result buffers. Tests call this via
resetZeroCopyResultBufferBindingForTest.
-
resetZeroCopyResultBufferBindingForTest()
→ void
-
Retained for source-compatible tests. Zero-copy availability is no longer
tied to a dynamically resolved native symbol.
-
streamCallWithBuffer(StreamBufferCallback fn, {int? maxSize, int? initialSize, bool? allowZeroCopy})
→ StreamBufferFetchResult?
-
Like callWithBuffer for stream fetch callbacks that also return hasMore.