fromFunctionPointer static method

ObjCBlock<NSArray Function(Pointer<Void>, CGRect)> fromFunctionPointer(
  1. Pointer<NativeFunction<Pointer<ObjCObjectImpl> Function(Pointer<Void> arg0, CGRect 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.NSArray Function(ffi.Pointer<ffi.Void>, objc.CGRect)> fromFunctionPointer(
  ffi.Pointer<
    ffi.NativeFunction<ffi.Pointer<objc.ObjCObjectImpl> Function(ffi.Pointer<ffi.Void> arg0, objc.CGRect arg1)>
  >
  ptr,
) => objc.ObjCBlock<objc.NSArray Function(ffi.Pointer<ffi.Void>, objc.CGRect)>(
  objc.newPointerBlock(_fnPtrCallable, ptr.cast()),
  retain: false,
  release: true,
);