implementAsBlocking static method

NSMachPortDelegate implementAsBlocking({
  1. void handleMachMessage_(
    1. Pointer<Void>
    )?,
  2. void handlePortMessage_(
    1. NSPortMessage
    )?,
  3. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSMachPortDelegate protocol. To implement multiple protocols, use addToBuilder or objc.ObjCProtocolBuilder directly. All methods that can be implemented as blocking listeners will be.

If $keepIsolateAlive is true, this protocol will keep this isolate alive until it is garbage collected by both Dart and ObjC.

Implementation

static NSMachPortDelegate implementAsBlocking({
  void Function(ffi.Pointer<ffi.Void>)? handleMachMessage_,
  void Function(objc.NSPortMessage)? handlePortMessage_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(debugName: 'NSMachPortDelegate');
  NSMachPortDelegate.handleMachMessage_.implementAsBlocking(
    builder,
    handleMachMessage_,
  );
  NSMachPortDelegate.handlePortMessage_.implementAsBlocking(
    builder,
    handlePortMessage_,
  );
  builder.addProtocol($protocol);
  return NSMachPortDelegate.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}