auto_route_library icon indicating copy to clipboard operation
auto_route_library copied to clipboard

Can not resolve initial route with path params only

Open maxbeech opened this issue 5 months ago • 0 comments

Thank you for the really cool package!

My routes are setup as below. They all work fine until I add a route with a path param like as shown.

When I add a path param, I can still navigate around the app, but if I go onto the /home/feedback path directly (eg. via a reload) without providing a path param, the app gives me a Can not resolve initial route error.

I've tried explicitly providing the /home/feedback path in the routes setup like shown below but it doesn't help sadly.

@AutoRouterConfig()
class AppRouter extends RootStackRouter {

  @override
  List<AutoRoute> get routes => [
    AutoRoute(path: "/loading", page: LoadingRoute.page, initial: true),
    AutoRoute(page: WelcomeRoute.page, path: "/${constants.NAV_WELCOME}"),
    AutoRoute(
        page: HomeRoute.page,
        path: "/${constants.NAV_HOME}",
        children: [
          AutoRoute(path: constants.NAV_DASHBOARD, page: DashboardRoute.page),
          AutoRoute(path: '${constants.NAV_FEEDBACK}', page: FeedbackRoute.page), // tried with and without adding this explicitly
          AutoRoute(path: '${constants.NAV_FEEDBACK}/:appname', page: FeedbackRoute.page),
          AutoRoute(path: constants.NAV_SETTINGS, page: SettingsRoute.page),
        ],
    ),
  ];
}

Any advice would be much appreciated! Many thanks.

maxbeech avatar Sep 23 '24 13:09 maxbeech