implement static method

NSSpeechSynthesizerDelegate implement({
  1. void speechSynthesizer_didFinishSpeaking_(
    1. NSSpeechSynthesizer,
    2. bool
    )?,
  2. void speechSynthesizer_willSpeakWord_ofString_(
    1. NSSpeechSynthesizer,
    2. NSRange,
    3. NSString
    )?,
  3. void speechSynthesizer_willSpeakPhoneme_(
    1. NSSpeechSynthesizer,
    2. int
    )?,
  4. void speechSynthesizer_didEncounterErrorAtIndex_ofString_message_(
    1. NSSpeechSynthesizer,
    2. DartNSUInteger,
    3. NSString,
    4. NSString,
    )?,
  5. void speechSynthesizer_didEncounterSyncMessage_(
    1. NSSpeechSynthesizer,
    2. NSString
    )?,
  6. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSSpeechSynthesizerDelegate 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 NSSpeechSynthesizerDelegate implement({
  void Function(NSSpeechSynthesizer, bool)?
  speechSynthesizer_didFinishSpeaking_,
  void Function(NSSpeechSynthesizer, NSRange, objc.NSString)?
  speechSynthesizer_willSpeakWord_ofString_,
  void Function(NSSpeechSynthesizer, int)?
  speechSynthesizer_willSpeakPhoneme_,
  void Function(
    NSSpeechSynthesizer,
    DartNSUInteger,
    objc.NSString,
    objc.NSString,
  )?
  speechSynthesizer_didEncounterErrorAtIndex_ofString_message_,
  void Function(NSSpeechSynthesizer, objc.NSString)?
  speechSynthesizer_didEncounterSyncMessage_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(
    debugName: 'NSSpeechSynthesizerDelegate',
  );
  NSSpeechSynthesizerDelegate.speechSynthesizer_didFinishSpeaking_.implement(
    builder,
    speechSynthesizer_didFinishSpeaking_,
  );
  NSSpeechSynthesizerDelegate.speechSynthesizer_willSpeakWord_ofString_
      .implement(builder, speechSynthesizer_willSpeakWord_ofString_);
  NSSpeechSynthesizerDelegate.speechSynthesizer_willSpeakPhoneme_.implement(
    builder,
    speechSynthesizer_willSpeakPhoneme_,
  );
  NSSpeechSynthesizerDelegate
      .speechSynthesizer_didEncounterErrorAtIndex_ofString_message_
      .implement(
        builder,
        speechSynthesizer_didEncounterErrorAtIndex_ofString_message_,
      );
  NSSpeechSynthesizerDelegate.speechSynthesizer_didEncounterSyncMessage_
      .implement(builder, speechSynthesizer_didEncounterSyncMessage_);
  builder.addProtocol($protocol);
  return NSSpeechSynthesizerDelegate.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}