fromFunction static method
ObjCBlock<NSInteger Function(Pointer<Void> , NSLayoutManager, NSInteger, UnsignedLong)>
fromFunction(
- NSControlCharacterAction fn(), {
- bool keepIsolateAlive = true,
Creates a block from a Dart function.
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.
If keepIsolateAlive is true, this block will keep this isolate alive
until it is garbage collected by both Dart and ObjC.
Implementation
static objc.ObjCBlock<
NSInteger Function(
ffi.Pointer<ffi.Void>,
NSLayoutManager,
NSInteger,
ffi.UnsignedLong,
)
>
fromFunction(
NSControlCharacterAction Function(
ffi.Pointer<ffi.Void>,
NSLayoutManager,
NSControlCharacterAction,
DartNSUInteger,
)
fn, {
bool keepIsolateAlive = true,
}) =>
objc.ObjCBlock<
NSInteger Function(
ffi.Pointer<ffi.Void>,
NSLayoutManager,
NSInteger,
ffi.UnsignedLong,
)
>(
objc.newClosureBlock(
_ObjCBlock_NSControlCharacterAction_ffiVoid_NSLayoutManager_NSControlCharacterAction_NSUInteger_closureCallable,
(
ffi.Pointer<ffi.Void> arg0,
ffi.Pointer<objc.ObjCObject> arg1,
int arg2,
int arg3,
) => fn(
arg0,
NSLayoutManager.castFromPointer(arg1, retain: true, release: true),
NSControlCharacterAction.fromValue(arg2),
arg3,
).value,
keepIsolateAlive,
),
retain: false,
release: true,
);