implement static method

NSImageDelegate implement({
  1. NSImage? imageDidNotDraw_inRect_(
    1. NSImage,
    2. NSRect
    )?,
  2. void image_willLoadRepresentation_(
    1. NSImage,
    2. NSImageRep
    )?,
  3. void image_didLoadRepresentationHeader_(
    1. NSImage,
    2. NSImageRep
    )?,
  4. void image_didLoadPartOfRepresentation_withValidRows_(
    1. NSImage,
    2. NSImageRep,
    3. DartNSInteger
    )?,
  5. void image_didLoadRepresentation_withStatus_(
    1. NSImage,
    2. NSImageRep,
    3. NSImageLoadStatus
    )?,
  6. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSImageDelegate 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 NSImageDelegate implement({
  NSImage? Function(NSImage, NSRect)? imageDidNotDraw_inRect_,
  void Function(NSImage, NSImageRep)? image_willLoadRepresentation_,
  void Function(NSImage, NSImageRep)? image_didLoadRepresentationHeader_,
  void Function(NSImage, NSImageRep, DartNSInteger)?
  image_didLoadPartOfRepresentation_withValidRows_,
  void Function(NSImage, NSImageRep, NSImageLoadStatus)?
  image_didLoadRepresentation_withStatus_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(debugName: 'NSImageDelegate');
  NSImageDelegate.imageDidNotDraw_inRect_.implement(
    builder,
    imageDidNotDraw_inRect_,
  );
  NSImageDelegate.image_willLoadRepresentation_.implement(
    builder,
    image_willLoadRepresentation_,
  );
  NSImageDelegate.image_didLoadRepresentationHeader_.implement(
    builder,
    image_didLoadRepresentationHeader_,
  );
  NSImageDelegate.image_didLoadPartOfRepresentation_withValidRows_.implement(
    builder,
    image_didLoadPartOfRepresentation_withValidRows_,
  );
  NSImageDelegate.image_didLoadRepresentation_withStatus_.implement(
    builder,
    image_didLoadRepresentation_withStatus_,
  );
  builder.addProtocol($protocol);
  return NSImageDelegate.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}