implementAsBlocking static method

NSToolbarDelegate implementAsBlocking({
  1. NSToolbarItem? toolbar_itemForItemIdentifier_willBeInsertedIntoToolbar_(
    1. NSToolbar,
    2. DartNSToolbarItemIdentifier,
    3. bool
    )?,
  2. NSArray toolbarDefaultItemIdentifiers_(
    1. NSToolbar
    )?,
  3. NSArray toolbarAllowedItemIdentifiers_(
    1. NSToolbar
    )?,
  4. NSArray toolbarSelectableItemIdentifiers_(
    1. NSToolbar
    )?,
  5. NSSet toolbarImmovableItemIdentifiers_(
    1. NSToolbar
    )?,
  6. bool toolbar_itemIdentifier_canBeInsertedAtIndex_(
    1. NSToolbar,
    2. DartNSToolbarItemIdentifier,
    3. DartNSInteger
    )?,
  7. void toolbarWillAddItem_(
    1. NSNotification
    )?,
  8. void toolbarDidRemoveItem_(
    1. NSNotification
    )?,
  9. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSToolbarDelegate 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 NSToolbarDelegate implementAsBlocking({
  NSToolbarItem? Function(NSToolbar, DartNSToolbarItemIdentifier, bool)?
  toolbar_itemForItemIdentifier_willBeInsertedIntoToolbar_,
  objc.NSArray Function(NSToolbar)? toolbarDefaultItemIdentifiers_,
  objc.NSArray Function(NSToolbar)? toolbarAllowedItemIdentifiers_,
  objc.NSArray Function(NSToolbar)? toolbarSelectableItemIdentifiers_,
  objc.NSSet Function(NSToolbar)? toolbarImmovableItemIdentifiers_,
  bool Function(NSToolbar, DartNSToolbarItemIdentifier, DartNSInteger)?
  toolbar_itemIdentifier_canBeInsertedAtIndex_,
  void Function(objc.NSNotification)? toolbarWillAddItem_,
  void Function(objc.NSNotification)? toolbarDidRemoveItem_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(debugName: 'NSToolbarDelegate');
  NSToolbarDelegate.toolbar_itemForItemIdentifier_willBeInsertedIntoToolbar_
      .implement(
        builder,
        toolbar_itemForItemIdentifier_willBeInsertedIntoToolbar_,
      );
  NSToolbarDelegate.toolbarDefaultItemIdentifiers_.implement(
    builder,
    toolbarDefaultItemIdentifiers_,
  );
  NSToolbarDelegate.toolbarAllowedItemIdentifiers_.implement(
    builder,
    toolbarAllowedItemIdentifiers_,
  );
  NSToolbarDelegate.toolbarSelectableItemIdentifiers_.implement(
    builder,
    toolbarSelectableItemIdentifiers_,
  );
  NSToolbarDelegate.toolbarImmovableItemIdentifiers_.implement(
    builder,
    toolbarImmovableItemIdentifiers_,
  );
  NSToolbarDelegate.toolbar_itemIdentifier_canBeInsertedAtIndex_.implement(
    builder,
    toolbar_itemIdentifier_canBeInsertedAtIndex_,
  );
  NSToolbarDelegate.toolbarWillAddItem_.implementAsBlocking(
    builder,
    toolbarWillAddItem_,
  );
  NSToolbarDelegate.toolbarDidRemoveItem_.implementAsBlocking(
    builder,
    toolbarDidRemoveItem_,
  );
  builder.addProtocol($protocol);
  return NSToolbarDelegate.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}