Why is onWillPop in WillPopScope ignored when using Navigator.pop?

 This is by design.

You will have to use Navigator.maybePop:

Tries to pop the current route of the navigator that most tightly encloses the given context, while honoring the route's Route.willPop state.

This means that only Navigator.maybePop honors onWillPop and Navigator.pop does not:

Navigator.of(context).maybePop();

Post a Comment

Previous Post Next Post

Subscribe Us


Get tutorials, Flutter news and other exclusive content delivered to your inbox. Join 1000+ growth-oriented Flutter developers subscribed to the newsletter

100% value, 0% spam. Unsubscribe anytime