refWithFinalizer method
- @Since('3.7')
- Pointer<
NativeFinalizerFunction> finalizer, { - Pointer<
Void> ? token,
A Dart view of the union referenced by this pointer.
Creates a reference accessing the fields of this union backed by native memory at address. The address must be aligned according to the union alignment rules of the platform.
Attaches finalizer
to the backing store of the union. If provided,
token
will be passed to finalizer
, otherwise the pointer (this
)
itself will be passed.
The pointer (this
) must not be used anymore if the union is not
guaranteed to be kept alive.
Prefer doing any native calls with the pointer before calling
refWithFinalizer.
This extension method must be invoked on a receiver of type Pointer<T>
where T
is a compile-time constant type.
Implementation
@Since('3.7')
external T refWithFinalizer(
Pointer<NativeFinalizerFunction> finalizer, {
Pointer<Void>? token,
});