implement static method

NSComboBoxDataSource implement({
  1. DartNSInteger numberOfItemsInComboBox_(
    1. NSComboBox
    )?,
  2. ObjCObjectBase? comboBox_objectValueForItemAtIndex_(
    1. NSComboBox,
    2. DartNSInteger
    )?,
  3. DartNSUInteger comboBox_indexOfItemWithStringValue_(
    1. NSComboBox,
    2. NSString
    )?,
  4. NSString? comboBox_completedString_(
    1. NSComboBox,
    2. NSString
    )?,
  5. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSComboBoxDataSource 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 NSComboBoxDataSource implement({
  DartNSInteger Function(NSComboBox)? numberOfItemsInComboBox_,
  objc.ObjCObjectBase? Function(NSComboBox, DartNSInteger)?
  comboBox_objectValueForItemAtIndex_,
  DartNSUInteger Function(NSComboBox, objc.NSString)?
  comboBox_indexOfItemWithStringValue_,
  objc.NSString? Function(NSComboBox, objc.NSString)?
  comboBox_completedString_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(debugName: 'NSComboBoxDataSource');
  NSComboBoxDataSource.numberOfItemsInComboBox_.implement(
    builder,
    numberOfItemsInComboBox_,
  );
  NSComboBoxDataSource.comboBox_objectValueForItemAtIndex_.implement(
    builder,
    comboBox_objectValueForItemAtIndex_,
  );
  NSComboBoxDataSource.comboBox_indexOfItemWithStringValue_.implement(
    builder,
    comboBox_indexOfItemWithStringValue_,
  );
  NSComboBoxDataSource.comboBox_completedString_.implement(
    builder,
    comboBox_completedString_,
  );
  builder.addProtocol($protocol);
  return NSComboBoxDataSource.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}