Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Flutter, Web, navigation 2.0 browser back button

I found about 10 project of the Navigation 2.0 Flutter Web Sample project through a hard searching.

And it seems that all web components change only on one screen, and no new screens appear. They are internally logically stacked, but they don’t look like a browser stack. I’ve seen every time that the back button doesn’t work like a normal website.

Is this not possible in Navigation 2.0?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

To handle back button click event, you need to use onPopPage of Navigator on your RouterDelegate.

It will be like

 onPopPage: (route, result) {
        if (!route.didPop(result)) {
          return false;
        }
        notifier.changeScreen(pageName: null); //home
        notifyListeners();
        return true;
      },

Here is my project and practices that will help you.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading