implement static method

NSTouchBarDelegate implement({
  1. NSTouchBarItem? touchBar_makeItemForIdentifier_(
    1. NSTouchBar,
    2. DartNSTouchBarItemIdentifier
    )?,
  2. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSTouchBarDelegate 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 NSTouchBarDelegate implement({
  NSTouchBarItem? Function(NSTouchBar, DartNSTouchBarItemIdentifier)?
  touchBar_makeItemForIdentifier_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(debugName: 'NSTouchBarDelegate');
  NSTouchBarDelegate.touchBar_makeItemForIdentifier_.implement(
    builder,
    touchBar_makeItemForIdentifier_,
  );
  builder.addProtocol($protocol);
  return NSTouchBarDelegate.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}