The functionality of onBackButtonPressed is supposed to be called when the user presses device back button. Currently onBackButtonPressed is only a behavior which should be called manually. The second issue is that usually the onBackButtonPressed method has a way of canceling the default system behavior by returning false (i.e. showing a dialog which cancels exit). In case of flutter the normal onBackButtonPressed method must return Future<bool>. Check this link for more information on how to really implement onBackButtonPressed.