Pages stack can be managed by either the Widget (AutoRouter.declarative) or the (StackRouter)

Viewed 27

I am using Declarative Routing from AutoRoute flutter package.

class App extends StatelessWidget {
final _appRouter = AppRouter();

@override
Widget build(BuildContext context) {
    return MaterialApp.router(
        routerDelegate: AutoRouterDelegate.declarative(   
            _appRouter,
            routes: (_) => [
              // if the user is logged in, they may proceed to the main App
              if (authService().isLoggedIn)
                HomeRoute()
              // if they are not logged in, bring them to the Login page 
              else
                LoginWrapperRoute(onLogin: () => authService().logIn),
            ],
        ),
        routeInformationParser:
            _appRouter.defaultRouteParser(includePrefixMatches: true));
}

}

IconButton(
        onPressed: () {
          context.pushRoute(const AlarmRoute());
        },
        icon: const Icon(Icons.notifications_active),
        color: const Color(0xFF666666),
      )

when I try to push or navigate to a page it gives me this error: Widget': Pages stack can be managed by either the Widget (AutoRouter.declarative) or the (StackRouter)

0 Answers
Related