implement static method

NSPortDelegate implement({
  1. void handlePortMessage_(
    1. NSPortMessage
    )?,
  2. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSPortDelegate protocol. To implement multiple protocols, use addToBuilder or objc.ObjCProtocolBuilder directly.

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

Implementation

static NSPortDelegate implement({
  void Function(NSPortMessage)? handlePortMessage_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(debugName: 'NSPortDelegate');
  NSPortDelegate$Builder.handlePortMessage_.implement(
    builder,
    handlePortMessage_,
  );
  builder.addProtocol($protocol);
  return NSPortDelegate.as(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}