Search code examples
flutter-webflutter-navigation

Flutter Web reload bug?


I'm having this issue where if I navigate to a page (through a named route), say for example /privacy, directly through the url, it works fine. When I click the refresh button, it stays on the page for a second, and goes to the root url ("/") and then traverses to a different page.

Here is a bit of my code:

routes: {
    Landing.route: (context) => Landing(),
    PrivPol.route: (context) => PrivPol(),
    "/": (context) => Loading(),
},
initialRoute: "/",

and from the tutorials I've been looking at if I directly type in localhost:port/{PrivPol.route} it should go to and stay on that page, even if I refresh the page.


Solution

  • So it turns out that in one of the other files, I had a future that was being called, which was causing the re-route to take place!