implementAsBlocking static method

NSAnimationDelegate implementAsBlocking({
  1. bool animationShouldStart_(
    1. NSAnimation
    )?,
  2. void animationDidStop_(
    1. NSAnimation
    )?,
  3. void animationDidEnd_(
    1. NSAnimation
    )?,
  4. double animation_valueForProgress_(
    1. NSAnimation,
    2. DartNSAnimationProgress
    )?,
  5. void animation_didReachProgressMark_(
    1. NSAnimation,
    2. DartNSAnimationProgress
    )?,
  6. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSAnimationDelegate 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 NSAnimationDelegate implementAsBlocking({
  bool Function(NSAnimation)? animationShouldStart_,
  void Function(NSAnimation)? animationDidStop_,
  void Function(NSAnimation)? animationDidEnd_,
  double Function(NSAnimation, DartNSAnimationProgress)?
  animation_valueForProgress_,
  void Function(NSAnimation, DartNSAnimationProgress)?
  animation_didReachProgressMark_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(debugName: 'NSAnimationDelegate');
  NSAnimationDelegate.animationShouldStart_.implement(
    builder,
    animationShouldStart_,
  );
  NSAnimationDelegate.animationDidStop_.implementAsBlocking(
    builder,
    animationDidStop_,
  );
  NSAnimationDelegate.animationDidEnd_.implementAsBlocking(
    builder,
    animationDidEnd_,
  );
  NSAnimationDelegate.animation_valueForProgress_.implement(
    builder,
    animation_valueForProgress_,
  );
  NSAnimationDelegate.animation_didReachProgressMark_.implementAsBlocking(
    builder,
    animation_didReachProgressMark_,
  );
  builder.addProtocol($protocol);
  return NSAnimationDelegate.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}