NativeBufferAllocator class final
Resolves the complete owned-buffer ABI; older libraries fail explicitly.
- Available extensions
Constructors
- NativeBufferAllocator(DynamicLibrary library)
- Borrows a library that the caller must keep loaded for process lifetime. Closing/reloading it invalidates callback addresses and is unsupported. Prefer NativeBufferAllocator.instance for the managed runtime library.
- NativeBufferAllocator.instance({String? libraryPath})
-
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isSupported → bool
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- supportsExternalTokens → bool
-
Complete producer-lease ABI v1 and native token adoption are available.
no setter
- supportsFlatBufferFrames → bool
-
Available on NativeBufferAllocator, provided by the NativeFrameAllocation extension
no setter - supportsOwnedE2eeEncryption → bool
-
Optional ABI for retaining an immutable native input and returning owned
ciphertext without copying the payload through Dart typed data.
no setter
- supportsSegmentedBuffers → bool
-
Available on NativeBufferAllocator, provided by the NativeOwnedSegmentSubmission extension
no setter - supportsWriteCompletion → bool
-
no setter
Methods
-
adoptTrustedNativeToken(
Pointer< NativeBufferToken> token) → NativeOwnedBuffer -
Claims one frozen handle published by a trusted native integration.
tokenmust point to initialized, writable NativeBufferToken storage. The native producer owns its release loop and resource lifetime; this method neither registers callbacks nor dispatches them on a Dart thread. -
allocate(
int length) → NativeBufferBuilder -
buildFlatBuffer(
ObjectBuilder model, {int initialSize = 1024, bool internStrings = false, bool deduplicateTables = true}) → NativeOwnedBuffer - Use fresh model object builders for each buffer, as required by the FlatBuffers runtime's offset caching. This does not copy the finished frame.
-
composeFlatBufferFrame(
NativeOwnedBuffer control, {NativeOwnedBuffer? arguments, NativeOwnedBuffer? argumentsKeywords, NativeOwnedBuffer? opaquePayload}) → NativeFlatBufferFrame -
Available on NativeBufferAllocator, provided by the NativeFrameAllocation extension
Retain a control-only WAMP envelope and independently owned application buffers. Args/kwargs must be CBOR array/dictionary bytes; opaque payloads remain uninterpreted. All input buffers stay live on success and failure. -
drainWrites(
int connectionId, {Duration? timeout}) → Future< void> -
encryptE2eeBuffer(
int sessionHandle, NativeOwnedBuffer plaintext, {String? keyId, required String cipher}) → NativeOwnedBuffer - Encrypt a retained frozen input handle and return ciphertext in a new native-owned buffer. No payload bytes cross the Dart/native boundary. The input is never consumed, including when validation or encryption fails.
-
flatBuffers(
{int initialSize = 1024, bool internStrings = false, bool deduplicateTables = true}) → NativeFlatBufferBuilder -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
send(
int connectionId, NativeOwnedBuffer buffer, {bool transfer = false}) → void - Queue acceptance only. A transferred buffer is consumed on success or native rejection; retained sends preserve the caller's immutable handle.
-
sendFrame(
int connectionId, NativeFlatBufferFrame frame, {bool transfer = false}) → void -
Available on NativeBufferAllocator, provided by the NativeFrameAllocation extension
Default sends retain the caller's frame. Transfer consumes it upon native submission, including runtime, serializer, connection and queue rejection. -
sendFrameTracked(
int connectionId, NativeFlatBufferFrame frame, {bool transfer = false}) → NativeWriteReceipt -
Available on NativeBufferAllocator, provided by the NativeFrameAllocation extension
-
sendSegments(
int connectionId, List< NativeOwnedBuffer> segments) → void -
Available on NativeBufferAllocator, provided by the NativeOwnedSegmentSubmission extension
Queues one complete encoded frame, retaining 1–64 frozen native spans. At least one span must be nonempty. Caller handles remain valid on both success and rejection; callers may dispose them after acceptance. This copies no payload bytes and does not parse or transcode the wire encoding. -
sendSegmentsTracked(
int connectionId, List< NativeOwnedBuffer> segments) → NativeWriteReceipt -
Available on NativeBufferAllocator, provided by the NativeOwnedSegmentSubmission extension
Reports queue acceptance and complete local write/flush, not peer delivery. Disposing the receipt does not cancel the queued frame or consume inputs. -
sendTracked(
int connectionId, NativeOwnedBuffer buffer, {bool transfer = false}) → NativeWriteReceipt - A positive receipt reports queue acceptance. Its Written outcome requires a complete write and flush. Transfers are consumed on native rejection, including receipt quota exhaustion; retained sends preserve the original.
-
toString(
) → String -
A string representation of this object.
inherited
-
validateFrozenBuffer(
NativeOwnedBuffer buffer, {int? maximumLength}) → void -
Check that
bufferis live, immutable and belongs to this native library. An optional limit is checked against native storage metadata.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited