Navigator always start with route '/'

This caught me out, too. If you look at the documentation for the initialRoute property:

If the route contains slashes, then it is treated as a "deep link", and before this route is pushed, the routes leading to this one are pushed also. For example, if the route was /a/b/c, then the app would start with the three routes /a, /a/b, and /a/b/c loaded, in that order.

What the example fails to explain is that / is also pushed. So if your initialRoute is /home then it first pushes /, then it pushes /home.

The (thankfully very simple) fix is to use routes that don't start with /, so in your case, just home :)

Tags:

Flutter