implementAsBlocking static method

NSSpeechRecognizerDelegate implementAsBlocking({
  1. void speechRecognizer_didRecognizeCommand_(
    1. NSSpeechRecognizer,
    2. NSString
    )?,
  2. bool $keepIsolateAlive = true,
})

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