onWillPop: onWillPop is a callback method that returns a Future value; if true, the screen can be popped; if false, the screen will not be popped out . However, the screen can still be popped by calling the Navigator.
Read moreHow do I close apps on Back button in flutter?
How to Implement Double back press to exit in flutter
Read moreHow do I close apps with back button?
In order to check when the ‘BACK’ button is pressed, use onBackPressed() method from the Android library . Next, perform a check to see if the ‘BACK’ button is pressed again within 2 seconds and will close the app if it is so. Otherwise, don’t exit.
Read moreHow do I completely close apps on flutter?
pop() : Works and is the RECOMMENDED way of exiting the app.
Read more