implementAsBlocking static method

NSInputServiceProvider implementAsBlocking({
  1. required void insertText_client_(
    1. ObjCObjectBase,
    2. ObjCObjectBase
    ),
  2. required void doCommandBySelector_client_(
    1. Pointer<ObjCSelector>,
    2. ObjCObjectBase
    ),
  3. required void markedTextAbandoned_(
    1. ObjCObjectBase? sender
    ),
  4. required void markedTextSelectionChanged_client_(
    1. NSRange,
    2. ObjCObjectBase
    ),
  5. required void terminate_(
    1. ObjCObjectBase? sender
    ),
  6. required bool canBeDisabled(),
  7. required bool wantsToInterpretAllKeystrokes(),
  8. required bool wantsToHandleMouseEvents(),
  9. required bool wantsToDelayTextChangeNotifications(),
  10. required void inputClientBecomeActive_(
    1. ObjCObjectBase? sender
    ),
  11. required void inputClientResignActive_(
    1. ObjCObjectBase? sender
    ),
  12. required void inputClientEnabled_(
    1. ObjCObjectBase? sender
    ),
  13. required void inputClientDisabled_(
    1. ObjCObjectBase? sender
    ),
  14. required void activeConversationWillChange_fromOldConversation_(
    1. ObjCObjectBase,
    2. DartNSInteger
    ),
  15. required void activeConversationChanged_toNewConversation_(
    1. ObjCObjectBase,
    2. DartNSInteger
    ),
  16. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSInputServiceProvider 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 NSInputServiceProvider implementAsBlocking({
  required void Function(objc.ObjCObjectBase, objc.ObjCObjectBase)
  insertText_client_,
  required void Function(ffi.Pointer<objc.ObjCSelector>, objc.ObjCObjectBase)
  doCommandBySelector_client_,
  required void Function(objc.ObjCObjectBase?) markedTextAbandoned_,
  required void Function(NSRange, objc.ObjCObjectBase)
  markedTextSelectionChanged_client_,
  required void Function(objc.ObjCObjectBase?) terminate_,
  required bool Function() canBeDisabled,
  required bool Function() wantsToInterpretAllKeystrokes,
  required bool Function() wantsToHandleMouseEvents,
  required bool Function() wantsToDelayTextChangeNotifications,
  required void Function(objc.ObjCObjectBase?) inputClientBecomeActive_,
  required void Function(objc.ObjCObjectBase?) inputClientResignActive_,
  required void Function(objc.ObjCObjectBase?) inputClientEnabled_,
  required void Function(objc.ObjCObjectBase?) inputClientDisabled_,
  required void Function(objc.ObjCObjectBase, DartNSInteger)
  activeConversationWillChange_fromOldConversation_,
  required void Function(objc.ObjCObjectBase, DartNSInteger)
  activeConversationChanged_toNewConversation_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(
    debugName: 'NSInputServiceProvider',
  );
  NSInputServiceProvider.insertText_client_.implementAsBlocking(
    builder,
    insertText_client_,
  );
  NSInputServiceProvider.doCommandBySelector_client_.implementAsBlocking(
    builder,
    doCommandBySelector_client_,
  );
  NSInputServiceProvider.markedTextAbandoned_.implementAsBlocking(
    builder,
    markedTextAbandoned_,
  );
  NSInputServiceProvider.markedTextSelectionChanged_client_
      .implementAsBlocking(builder, markedTextSelectionChanged_client_);
  NSInputServiceProvider.terminate_.implementAsBlocking(builder, terminate_);
  NSInputServiceProvider.canBeDisabled.implement(builder, canBeDisabled);
  NSInputServiceProvider.wantsToInterpretAllKeystrokes.implement(
    builder,
    wantsToInterpretAllKeystrokes,
  );
  NSInputServiceProvider.wantsToHandleMouseEvents.implement(
    builder,
    wantsToHandleMouseEvents,
  );
  NSInputServiceProvider.wantsToDelayTextChangeNotifications.implement(
    builder,
    wantsToDelayTextChangeNotifications,
  );
  NSInputServiceProvider.inputClientBecomeActive_.implementAsBlocking(
    builder,
    inputClientBecomeActive_,
  );
  NSInputServiceProvider.inputClientResignActive_.implementAsBlocking(
    builder,
    inputClientResignActive_,
  );
  NSInputServiceProvider.inputClientEnabled_.implementAsBlocking(
    builder,
    inputClientEnabled_,
  );
  NSInputServiceProvider.inputClientDisabled_.implementAsBlocking(
    builder,
    inputClientDisabled_,
  );
  NSInputServiceProvider.activeConversationWillChange_fromOldConversation_
      .implementAsBlocking(
        builder,
        activeConversationWillChange_fromOldConversation_,
      );
  NSInputServiceProvider.activeConversationChanged_toNewConversation_
      .implementAsBlocking(
        builder,
        activeConversationChanged_toNewConversation_,
      );
  builder.addProtocol($protocol);
  return NSInputServiceProvider.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}