The WillPopScope widget can be used with the approach from above in order to properly handle the back button in Flutter application in the case nested navigators are provided. It controls what should happen when you press the back button. As the onInvoked method is deprecated nowadays, the WillPopScope is the correct approach to reach this. So, you need to wrap these nested navigators with the WillPopScope and handle the back navigation behavior manually.