Flutter-Web : How to access a page from the URL with auto_route

Viewed 210

Does someone know how to access a web page in flutter just by taping her path ?

It seems to be a bug with the autoroute package but maybe someone got a response to this issue...

So I use auto_route package in my web app to replace the navigator class from Flutter. But it seems that the package doesn't allow users to access pages by taping the URL only.

@MaterialAutoRouter(
  replaceInRouteName: 'Page,Route',
  routes: <AutoRoute>[
    AutoRoute(
      path: 'WebMenu',
      page: HomePage,
      initial: true,
    ),
    AutoRoute(
      path: 'WebMenu/Establishments',
      page: EstablishmentsPage,
    ),
    AutoRoute(
      path: 'WebMenu/:name/Tables',
      page: TablesPage,
    ),
    AutoRoute(
      path: 'WebMenu/:name/Tables',
      page: BasketIdToUsePage,
    ),
    AutoRoute(
      path: 'WebMenu/:name/:value',
      page: WebMenuPage,
      children: [
        AutoRoute(
            path: 'Drinks',
            name: 'DrinksRouter',
            page: EmptyRouterPage,
            children: [
              AutoRoute(
                path: '',
                page: DrinksPage,
              ),
              AutoRoute(
                path: 'Details/:name',
                page: AddsPage,
              )
            ]),
        AutoRoute(
            path: 'Starters',
            name: 'StartersRouter',
            page: EmptyRouterPage,
            children: [
              AutoRoute(
                path: '',
                page: StartersPage,
              ),
              AutoRoute(
                path: 'Details/:name',
                page: AddsPage,
              ),
            ]),
        AutoRoute(
            path: 'Meals',
            name: 'MealsRouter',
            page: EmptyRouterPage,
            children: [
              AutoRoute(
                path: '',
                page: MealsPage,
              ),
              AutoRoute(
                path: 'Details/:name',
                page: AddsPage,
              )
            ]),
        AutoRoute(
            path: 'Desserts',
            name: 'DessertsRouter',
            page: EmptyRouterPage,
            children: [
              AutoRoute(
                path: '',
                page: DessertsPage,
              ),
              AutoRoute(
                path: 'Details/:name',
                page: AddsPage,
              )
            ]),
        /*AutoRoute(
          path: 'Basket/:id',
          page: LocalBasketPage,
        ),*/
        AutoRoute(
          path: 'Basket/:id',
          page: BasketPage,
        ),
      ],
    ),
    AutoRoute(
      path: 'Basket/:id',
      page: LocalBasketPage,
    ),
  ],
)
class $AppRouter {}

This is the repository of the project : https://github.com/BGGBGIBS/clean_architecture.git

0 Answers
Related