NativeFinalizer constructor
- Pointer<
NativeFinalizerFunction> callback
Creates a finalizer with the given finalization callback.
The callback must be a native function which can be executed outside of
a Dart isolate. This also means that passing an FFI trampoline (a function
a function pointer obtained via Pointer.fromFunction) is not supported.
The callback is not allowed to re-enter the Dart VM via Dart C APIs, with
two exceptions: it is allowed to call Dart_DeletePersistentHandle and
Dart_DeleteWeakPersistentHandle. Calling any other Dart C API function
results in undefined behavior, which means it can cause anything from
crashes and deadlocks to silent memory corruptions.
The callback might be invoked on an arbitrary thread. It will have a
current isolate group but will not have a current isolate.
Implementation
external factory NativeFinalizer(Pointer<NativeFinalizerFunction> callback);