NativeFinalizer constructor Null safety

NativeFinalizer(
  1. 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 means that passing an FFI trampoline (a function pointer obtained via Pointer.fromFunction) is not supported.

The callback might be invoked on an arbitrary thread and not necessary on the same thread that created NativeFinalizer.

Implementation

// TODO(https://dartbug.com/47778): Implement isolate independent code and
// update the above comment.
external factory NativeFinalizer(Pointer<NativeFinalizerFunction> callback);