createRouter method

  1. @nonVirtual
  2. @override
GoRouter createRouter()
override

Implementation

@nonVirtual
@override
GoRouter createRouter() {
  return GoRouter(
    refreshListenable: authRepository.status,
    redirect: redirect,
    initialLocation: AptofRoutes.splash,
    routes: [
      ...authRoutes,
      StatefulShellRoute.indexedStack(
        builder: (context, state, navigationShell) {
          return Scaffold(
            body: navigationShell,
            bottomNavigationBar: NavigationBar(
              selectedIndex: navigationShell.currentIndex,
              onDestinationSelected: (index) => navigationShell.goBranch(
                index,
                initialLocation: index == navigationShell.currentIndex,
              ),
              destinations: [
                ...destinations(context),
                profileDestination(context),
              ],
            ),
          );
        },
        branches: [...branches(), profileBranch()],
      ),
    ],
  );
}