WillPopScope( onWillPop: () async { // You can do some work here. // Returning true allows the pop to happen, returning false prevents it. return true; }, child: ... // Your Scaffold goes here. );