fromFunctionPointer static method

ObjCBlock<NSSet Function(Pointer<Void>, NSToolbar)> fromFunctionPointer(
  1. Pointer<NativeFunction<instancetype Function(Pointer<Void> arg0, Pointer<ObjCObject> arg1)>> ptr
)

Creates a block from a C function pointer.

This block must be invoked by native code running on the same thread as the isolate that registered it. Invoking the block on the wrong thread will result in a crash.

Implementation

static objc.ObjCBlock<objc.NSSet Function(ffi.Pointer<ffi.Void>, NSToolbar)>
fromFunctionPointer(
  ffi.Pointer<
    ffi.NativeFunction<
      ffi.Pointer<objc.ObjCObject> Function(
        ffi.Pointer<ffi.Void> arg0,
        ffi.Pointer<objc.ObjCObject> arg1,
      )
    >
  >
  ptr,
) => objc.ObjCBlock<objc.NSSet Function(ffi.Pointer<ffi.Void>, NSToolbar)>(
  objc.newPointerBlock(
    _ObjCBlock_NSSet_ffiVoid_NSToolbar_fnPtrCallable,
    ptr.cast(),
  ),
  retain: false,
  release: true,
);