refWithFinalizer method

  1. @Since('3.7')
T refWithFinalizer(
  1. Pointer<NativeFinalizerFunction> finalizer, {
  2. Pointer<Void>? token,
})

A Dart view of the struct referenced by this pointer.

Creates a reference accessing the fields of this struct backed by native memory at address. The address must be aligned according to the struct alignment rules of the platform.

Attaches finalizer to the backing store of the struct. 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 struct 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,
});