Fix RouteAware.didPushNext documentation inaccuracy by ishaquehassan · Pull Request #183097 · flutter/flutter

The documentation for RouteAware.didPushNext incorrectly states that the method is called when "the current route is no longer visible". However, tracing through the source code in routes.dart shows that didPushNext is called synchronously during the push operation in RouteObserver.didPush(), before the transition animation completes. At this point, the current route may still be partially visible as it animates out.

This PR corrects the documentation to accurately describe when didPushNext is called and provides guidance for developers who need to perform actions after the route is fully obscured.

This PR implements the analysis from my earlier comment on this issue.

Fixes #24594

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.