implement static method

NSConnectionDelegate implement({
  1. bool makeNewConnection_sender_(
    1. NSConnection,
    2. NSConnection
    )?,
  2. bool connection_shouldMakeNewConnection_(
    1. NSConnection,
    2. NSConnection
    )?,
  3. NSData authenticationDataForComponents_(
    1. NSArray
    )?,
  4. bool authenticateComponents_withData_(
    1. NSArray,
    2. NSData
    )?,
  5. ObjCObjectBase createConversationForConnection_(
    1. NSConnection
    )?,
  6. bool connection_handleRequest_(
    1. NSConnection,
    2. NSDistantObjectRequest
    )?,
  7. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSConnectionDelegate 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 NSConnectionDelegate implement({
  bool Function(NSConnection, NSConnection)? makeNewConnection_sender_,
  bool Function(NSConnection, NSConnection)?
  connection_shouldMakeNewConnection_,
  objc.NSData Function(objc.NSArray)? authenticationDataForComponents_,
  bool Function(objc.NSArray, objc.NSData)? authenticateComponents_withData_,
  objc.ObjCObjectBase Function(NSConnection)?
  createConversationForConnection_,
  bool Function(NSConnection, NSDistantObjectRequest)?
  connection_handleRequest_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(debugName: 'NSConnectionDelegate');
  NSConnectionDelegate.makeNewConnection_sender_.implement(
    builder,
    makeNewConnection_sender_,
  );
  NSConnectionDelegate.connection_shouldMakeNewConnection_.implement(
    builder,
    connection_shouldMakeNewConnection_,
  );
  NSConnectionDelegate.authenticationDataForComponents_.implement(
    builder,
    authenticationDataForComponents_,
  );
  NSConnectionDelegate.authenticateComponents_withData_.implement(
    builder,
    authenticateComponents_withData_,
  );
  NSConnectionDelegate.createConversationForConnection_.implement(
    builder,
    createConversationForConnection_,
  );
  NSConnectionDelegate.connection_handleRequest_.implement(
    builder,
    connection_handleRequest_,
  );
  builder.addProtocol($protocol);
  return NSConnectionDelegate.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}