implementAsBlocking static method

NSGlyphStorage implementAsBlocking({
  1. required void insertGlyphs_length_forStartingGlyphAtIndex_characterIndex_(
    1. Pointer<NSGlyph>,
    2. DartNSUInteger,
    3. DartNSUInteger,
    4. DartNSUInteger,
    ),
  2. required void setIntAttribute_value_forGlyphAtIndex_(
    1. DartNSInteger,
    2. DartNSInteger,
    3. DartNSUInteger
    ),
  3. required NSAttributedString attributedString(),
  4. required int layoutOptions(),
  5. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSGlyphStorage 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 NSGlyphStorage implementAsBlocking({
  required void Function(
    ffi.Pointer<NSGlyph>,
    DartNSUInteger,
    DartNSUInteger,
    DartNSUInteger,
  )
  insertGlyphs_length_forStartingGlyphAtIndex_characterIndex_,
  required void Function(DartNSInteger, DartNSInteger, DartNSUInteger)
  setIntAttribute_value_forGlyphAtIndex_,
  required NSAttributedString Function() attributedString,
  required DartNSUInteger Function() layoutOptions,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(debugName: 'NSGlyphStorage');
  NSGlyphStorage.insertGlyphs_length_forStartingGlyphAtIndex_characterIndex_
      .implementAsBlocking(
        builder,
        insertGlyphs_length_forStartingGlyphAtIndex_characterIndex_,
      );
  NSGlyphStorage.setIntAttribute_value_forGlyphAtIndex_.implementAsBlocking(
    builder,
    setIntAttribute_value_forGlyphAtIndex_,
  );
  NSGlyphStorage.attributedString.implement(builder, attributedString);
  NSGlyphStorage.layoutOptions.implement(builder, layoutOptions);
  builder.addProtocol($protocol);
  return NSGlyphStorage.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}