Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Web] Initial route provided by URL gets ignored #1847

Closed
peer-f opened this issue Jan 25, 2024 · 1 comment
Closed

[Web] Initial route provided by URL gets ignored #1847

peer-f opened this issue Jan 25, 2024 · 1 comment

Comments

@peer-f
Copy link

peer-f commented Jan 25, 2024

I have an issue where I want to launch my web app and then navigate to the given path in the URL. This is needed to link to news articles inside of the web app.

The splash screen is shown initially and then I programmatically route the user to the next screen using my initialization guard. So far this works fine. Now when I append a path such as /main to the url the path gets ignored and I immediately get this error:

══╡ EXCEPTION CAUGHT BY FLUTTER FRAMEWORK ╞═════════════════════════════════════════════════════════
js_primitives.dart:30 The following message was thrown:
js_primitives.dart:30 Could not navigate to initial route.
js_primitives.dart:30 The requested route name was: "/main"
js_primitives.dart:30 There was no corresponding route in the app, and therefore the initial route specified will be
js_primitives.dart:30 ignored and "/" will be used instead.
js_primitives.dart:30 ═════════
════════════════════════════════════════════════════════════════════════════

My app_router.dart:

  List<AutoRoute> get routes => [
        AutoRoute(
          page: SplashRoute.page,
          path: '/splash',
          initial: true,
          guards: [
            InitializationGuard(ref),
          ],
        ),
        AutoRoute(
          page: MainTabsRoute.page,
          path: '/main',
        ),
        ...
        ];

I'm unsure if this error is Flutter related or related to auto_route. I have also played around with the deeplinkBuilder but I never have the chance to access the initial path.

@peer-f
Copy link
Author

peer-f commented Jan 26, 2024

I solved this issue by myself. For initializing early dependencies I showed an early splash screen using runApp() which obviously led to this error.

@peer-f peer-f closed this as completed Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant