implement static method

NSSoundDelegate implement({
  1. void sound_didFinishPlaying_(
    1. NSSound,
    2. bool
    )?,
  2. bool $keepIsolateAlive = true,
})

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