From my understanding of how deep links work, if you are loading a page from outside of your Web app, the home page is always referred to first. Once the home page is loaded, the requested page will then load. That is completely normal.
I use go_router, so this may not be directly what you are asking for. However, I was experiencing similar issues early on. Since then, I did find my resolution, so hopefully this explanation can help you find yours. As a note, the go_router package is officially supported by the flutter team, and I highly suggest using it. It's extremely easy to use.
My first issue involves the below:
GoRouter can push a screen onto the Navigator's history stack using
context.push(), and can pop the current screen via context.pop().
However, imperative navigation is known to cause issues with the
browser history.
I was originally pushing, popping, and replacing my pages as I saw fit. When returning to the home screen, I would also add a loop to pop all pages, except for the home page. This probably isn't wrong for a mobile app, but isn't the best for a Web app. In the end, I was basically just trying to keep one page open at a time.
To resolve this issue:
Navigating to a destination in GoRouter will replace the current stack
of screens with the screens configured to be displayed for the
destination route. To change to a new screen, call context.go() with a
URL:
build(BuildContext context) {
return TextButton(
onPressed: () => context.go('/users/123'),
);
}
When I started using "context.go()" instead of pushing a page, the current page was being replaced by the next, rather than adding a new page on top of the stack - or rather, it was the new, single-page, stack. I had no more need to push or pop anything, and only one page was being displayed at a time. This was my desired outcome, and I believe this is what you want as well. If you choose not to use go_router, then this might be similar to a "replace()" method, where you replace the current page with the next, rather than pushing a page on top of the stack.
The second flaw was that I was using nested routes. If you are using nested routes, the root page will always be at the bottom of the stack, and any nested pages will sit on top. If you combine pushing a page with nesting, this may also be part of your issue. From my experience, nested routes make sense in mobile apps, where you can use the back button on the device to navigate back and forth. However, we have to keep in mind that Web apps use a browser, which has it's own history stack. A back button in a mobile app may not translate the same as the browser's back button.
From the sound of it, your routing may be pushing items to the stack, when it should not be. Perhaps set your routing method to use a similar function to context.go(), where the current page is replaced with the next, instead of pushing a new page to the stack.
Hopefully this helps, or at least points you in the right direction!