addToBuilder static method

void addToBuilder(
  1. ObjCProtocolBuilder builder, {
  2. required DartNSInteger collectionView_numberOfItemsInSection_(
    1. NSCollectionView,
    2. DartNSInteger
    ),
  3. required NSCollectionViewItem collectionView_itemForRepresentedObjectAtIndexPath_(
    1. NSCollectionView,
    2. NSIndexPath
    ),
  4. DartNSInteger numberOfSectionsInCollectionView_(
    1. NSCollectionView
    )?,
  5. NSView collectionView_viewForSupplementaryElementOfKind_atIndexPath_(
    1. NSCollectionView,
    2. DartNSCollectionViewSupplementaryElementKind,
    3. NSIndexPath
    )?,
  6. bool $keepIsolateAlive = true,
})

Adds the implementation of the NSCollectionViewDataSource protocol to an existing objc.ObjCProtocolBuilder.

Note: You cannot call this method after you have called builder.build.

Implementation

static void addToBuilder(
  objc.ObjCProtocolBuilder builder, {
  required DartNSInteger Function(NSCollectionView, DartNSInteger)
  collectionView_numberOfItemsInSection_,
  required NSCollectionViewItem Function(NSCollectionView, NSIndexPath)
  collectionView_itemForRepresentedObjectAtIndexPath_,
  DartNSInteger Function(NSCollectionView)? numberOfSectionsInCollectionView_,
  NSView Function(
    NSCollectionView,
    DartNSCollectionViewSupplementaryElementKind,
    NSIndexPath,
  )?
  collectionView_viewForSupplementaryElementOfKind_atIndexPath_,
  bool $keepIsolateAlive = true,
}) {
  NSCollectionViewDataSource.collectionView_numberOfItemsInSection_.implement(
    builder,
    collectionView_numberOfItemsInSection_,
  );
  NSCollectionViewDataSource
      .collectionView_itemForRepresentedObjectAtIndexPath_
      .implement(
        builder,
        collectionView_itemForRepresentedObjectAtIndexPath_,
      );
  NSCollectionViewDataSource.numberOfSectionsInCollectionView_.implement(
    builder,
    numberOfSectionsInCollectionView_,
  );
  NSCollectionViewDataSource
      .collectionView_viewForSupplementaryElementOfKind_atIndexPath_
      .implement(
        builder,
        collectionView_viewForSupplementaryElementOfKind_atIndexPath_,
      );
  builder.addProtocol($protocol);
}