implement static method

NSTextLayoutManagerDelegate implement({
  1. NSTextLayoutFragment textLayoutManager_textLayoutFragmentForLocation_inTextElement_(
    1. NSTextLayoutManager,
    2. NSTextLocation,
    3. NSTextElement
    )?,
  2. bool textLayoutManager_shouldBreakLineBeforeLocation_hyphenating_(
    1. NSTextLayoutManager,
    2. NSTextLocation,
    3. bool
    )?,
  3. NSDictionary? textLayoutManager_renderingAttributesForLink_atLocation_defaultAttributes_(
    1. NSTextLayoutManager,
    2. ObjCObjectBase,
    3. NSTextLocation,
    4. NSDictionary,
    )?,
  4. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSTextLayoutManagerDelegate 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 NSTextLayoutManagerDelegate implement({
  NSTextLayoutFragment Function(
    NSTextLayoutManager,
    NSTextLocation,
    NSTextElement,
  )?
  textLayoutManager_textLayoutFragmentForLocation_inTextElement_,
  bool Function(NSTextLayoutManager, NSTextLocation, bool)?
  textLayoutManager_shouldBreakLineBeforeLocation_hyphenating_,
  objc.NSDictionary? Function(
    NSTextLayoutManager,
    objc.ObjCObjectBase,
    NSTextLocation,
    objc.NSDictionary,
  )?
  textLayoutManager_renderingAttributesForLink_atLocation_defaultAttributes_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(
    debugName: 'NSTextLayoutManagerDelegate',
  );
  NSTextLayoutManagerDelegate
      .textLayoutManager_textLayoutFragmentForLocation_inTextElement_
      .implement(
        builder,
        textLayoutManager_textLayoutFragmentForLocation_inTextElement_,
      );
  NSTextLayoutManagerDelegate
      .textLayoutManager_shouldBreakLineBeforeLocation_hyphenating_
      .implement(
        builder,
        textLayoutManager_shouldBreakLineBeforeLocation_hyphenating_,
      );
  NSTextLayoutManagerDelegate
      .textLayoutManager_renderingAttributesForLink_atLocation_defaultAttributes_
      .implement(
        builder,
        textLayoutManager_renderingAttributesForLink_atLocation_defaultAttributes_,
      );
  builder.addProtocol($protocol);
  return NSTextLayoutManagerDelegate.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}