fromFunction static method

ObjCBlock<CLLocationCoordinate2D Function(Pointer<Void>)> fromFunction(
  1. CLLocationCoordinate2D fn(
    1. Pointer<Void>
    ), {
  2. 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<CLLocationCoordinate2D Function(ffi.Pointer<ffi.Void>)> fromFunction(CLLocationCoordinate2D Function(ffi.Pointer<ffi.Void> ) fn,
        {bool keepIsolateAlive = true}) =>
    objc.ObjCBlock<CLLocationCoordinate2D Function(ffi.Pointer<ffi.Void>)>(objc.newClosureBlock(_ObjCBlock_CLLocationCoordinate2D_ffiVoid_closureCallable, (ffi.Pointer<ffi.Void> arg0) => fn(arg0), keepIsolateAlive),
        retain: false, release: true);