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< freeFn, {int externalSize = 4096})Void Function(Pointer< >T> )> -
Wraps
_ptrand attaches a ffi.NativeFinalizer callingfreeFn(for example,addresses.EVP_PKEY_freeoraddresses.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
fnwith the underlyingPointer<T>, keepingthisreachable untilfncompletes so the GC finalizer cannot run mid-call.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited