我认为您可以利用
WillPopScope小部件。您可以传递一个回调函数,当视图关于pop时将调用该函数。只需执行弹出之前要完成的所有任务,然后返回true即可。
例:
Future<bool> _willPopCallback() async { // await showDialog or Show add banners or whatever // then return true; // return true if the route to be popped}//then pass the callback to WillPopScopenew WillPopScope(child: new Scaffold(), onWillPop: _willPopCallback)希望有帮助!



