How to change what the back button does in dart

How can I change the function of the back button in dart flutter
enter image description here

I really didn’t try anything because tbh, i didn’t find what to try

>Solution :

You need simply to override the leading property in the AppBar with a new IconButton, then set your specific method:

 leading: IconButton(
  onPressed: () {
  icon: Icon(,

Leave a Reply