implement static method

NSTextStorageObserving implement({
  1. required NSTextStorage? textStorage(),
  2. required void setTextStorage_(
    1. NSTextStorage?
    ),
  3. required void processEditingForTextStorage_edited_range_changeInLength_invalidatedRange_(
    1. NSTextStorage,
    2. NSTextStorageEditActions,
    3. NSRange,
    4. DartNSInteger,
    5. NSRange,
    ),
  4. required void performEditingTransactionForTextStorage_usingBlock_(
    1. NSTextStorage,
    2. ObjCBlock<Void Function()>
    ),
  5. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSTextStorageObserving 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 NSTextStorageObserving implement({
  required NSTextStorage? Function() textStorage,
  required void Function(NSTextStorage?) setTextStorage_,
  required void Function(
    NSTextStorage,
    NSTextStorageEditActions,
    NSRange,
    DartNSInteger,
    NSRange,
  )
  processEditingForTextStorage_edited_range_changeInLength_invalidatedRange_,
  required void Function(NSTextStorage, objc.ObjCBlock<ffi.Void Function()>)
  performEditingTransactionForTextStorage_usingBlock_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(
    debugName: 'NSTextStorageObserving',
  );
  NSTextStorageObserving.textStorage.implement(builder, textStorage);
  NSTextStorageObserving.setTextStorage_.implement(builder, setTextStorage_);
  NSTextStorageObserving
      .processEditingForTextStorage_edited_range_changeInLength_invalidatedRange_
      .implement(
        builder,
        processEditingForTextStorage_edited_range_changeInLength_invalidatedRange_,
      );
  NSTextStorageObserving.performEditingTransactionForTextStorage_usingBlock_
      .implement(
        builder,
        performEditingTransactionForTextStorage_usingBlock_,
      );
  builder.addProtocol($protocol);
  return NSTextStorageObserving.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}