animationCompletion property
Future<void> ?
get
animationCompletion
Returns the current animation completion future if the current route is animating
If the current route is not animating, it returns null
Implementation
Future<void>? get animationCompletion {
if (_animation case final animation?) {
if (animation.isAnimating) {
// if the current route is animating, we wait for it to complete
final completer = Completer<void>();
void listener(AnimationStatus status) {
if (!animation.isAnimating) {
completer.complete();
animation.removeStatusListener(listener);
}
}
animation.addStatusListener(listener);
return completer.future;
}
}
return null;
}