NativeHandle<T extends NativeType> class final

A GC-managed wrapper around a BoringSSL Pointer<T> that attaches a shared ffi.NativeFinalizer and supports deterministic dispose.

Because NativeHandle implements ffi.Finalizable, calling use ensures that the Dart VM compiler inserts a reachability fence keeping this alive until use returns, preventing premature finalization while a native call is in progress.

Implemented types

Constructors

NativeHandle(Pointer<T> _ptr, Pointer<NativeFunction<Void Function(Pointer<T>)>> freeFn, {int externalSize = 4096})
Wraps _ptr and attaches a ffi.NativeFinalizer calling freeFn (for example, addresses.EVP_PKEY_free or addresses.X509_free).

Properties

hashCode → int
The hash code for this object.
no setterinherited
isDisposed → bool
Whether dispose has been called on this handle.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
Deterministically frees the native resource and detaches the GC finalizer.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited
use<R>(R fn(Pointer<T> ptr)) → R
Invokes fn with the underlying Pointer<T>, keeping this reachable until fn completes so the GC finalizer cannot run mid-call.

Operators

operator ==(Object other) → bool
The equality operator.
inherited