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

navigateTo not finding route #256

Open
achilds97 opened this issue Dec 23, 2021 · 0 comments
Open

navigateTo not finding route #256

achilds97 opened this issue Dec 23, 2021 · 0 comments

Comments

@achilds97
Copy link

I am using fluro to handle the routing for our web app. I am able to get everything working using the standard Navigator.pushNamed, but when I try and use FluroRouter.appRouter.navigateTo so that I can pass in a custom class that is handling the session data.

When I use navigateTo flutter returns an error saying no route was found to handle 'dashboard'

Here is my code where I set up the routes:


  static Handler _homeHandler = Handler(handlerFunc: (BuildContext? context, Map<String, dynamic> params) {
    return MyApp();
  });

  static Handler _dashboardHandler = Handler(handlerFunc: (BuildContext? context, Map<String, dynamic> params) {
    final session = context!.settings!.arguments as Session;

    return DashboardScreen(session: session);
  });

  static Handler _siteHandler = Handler(handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
    final session = context!.settings!.arguments as Session;

    return SiteScreen(siteName: params['id']![0], session: session);
  });

  static void setupRouter() {
    router.define(
      '/',
      handler: _homeHandler,
    );

    router.define(
      'dashboard',
      handler: _dashboardHandler,
    );

    print("defining sites/:id");
    router.define(
      'sites/:id',
      handler: _siteHandler
    );
  }

and then I am calling it in the onSelectChanged of a datatable like this:

      FluroRouter.appRouter.navigateTo(
        context,
        'dashboard',
        routeSettings: RouteSettings(
          arguments: session,
        ),
      );
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