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();