didPushNext method
Called when a new route has been pushed on top of this route, temporarily obscuring it.
This method is called synchronously during the push operation, before the transition animation completes. The current route may still be partially visible as it animates out. To perform actions after the route is fully obscured, consider using ModalRoute.secondaryAnimation to listen for animation completion, for example:
{@tool snippet}
ModalRoute.of(context)?.secondaryAnimation?.addStatusListener((AnimationStatus status) {
if (status == AnimationStatus.completed) {
// This route is now fully obscured by the new route.
}
});
{@end-tool}
Implementation
@override
void didPushNext() {
if (mounted) {
setState(() {
screenVisible = false;
});
}
_disposeCameraChannel();
}