whenStopped method

  1. @protected
Future<void>? whenStopped(
  1. AnimationController controller
)

Completes in the frame controller stops in, or is null if it has.

Implementation

@protected
Future<void>? whenStopped(AnimationController controller) {
  if (!controller.isAnimating) {
    return null;
  }
  final stopped = Completer<void>.sync();
  void handleStatus(AnimationStatus status) {
    if (status.isAnimating) {
      return;
    }
    controller.removeStatusListener(handleStatus);
    stopped.complete();
  }

  controller.addStatusListener(handleStatus);
  return stopped.future;
}