Milad-Akarie / auto_route_library

Flutter route generator
MIT License
1.56k stars 394 forks source link

Remove Splash Screen #1880

Open BijalSutariya opened 6 months ago

BijalSutariya commented 6 months ago

Hello @Milad-Akarie , Thanks for this amazing package! As we now app has launcher screen as splash screen on flutter app. I want to check some authentication related conditions when app started. here is my app route flow

      AutoRoute(
          page: OnBoardingRoute.page,
          path: OnBoardingScreen.routeName,
        ),
        AutoRoute(
          page: SignInRoute.page,
          path: SignInScreen.routeName,
        ),
        AutoRoute(
          page: SignupRoute.page,
          path: SignupScreen.routeName,
        ),
        AutoRoute(
          page: VerificationRoute.page,
          path: VerificationScreen.routeName,
        ),
       AutoRoute(
          page: DashboardRoute.page,
          path: '/',
          children: [
            AutoRoute(
              page: HomeTabRoute.page,
              path: 'home',
              children: [
                RedirectRoute(
                  path: '*',
                  redirectTo: HomeScreen.routeName,
                ),
                AutoRoute(
                  page: HomeRoute.page,
                  path: HomeScreen.routeName,
                ),
              ],
            ),
            AutoRoute(
              page: ExploreTabRoute.page,
              path: 'explore',
              children: [
                //RedirectRoute(path: '', redirectTo: ExploreScreen.routeName),
                AutoRoute(
                  page: ExploreRoute.page,
                  path: ExploreScreen.routeName,
                ),
              ],
            ),
            AutoRoute(
              page: MessageTabRoute.page,
              path: 'message',
              children: [
                //RedirectRoute(path: '', redirectTo: MessageScreen.routeName),
                AutoRoute(
                  page: MessageRoute.page,
                  path: MessageScreen.routeName,
                  maintainState: false,
                ),
              ],
            ),
            AutoRoute(
              page: ProfileTabRoute.page,
              path: 'profile',
              children: [
                // RedirectRoute(path: '', redirectTo: ProfileScreen.routeName),
                AutoRoute(
                  page: ProfileRoute.page,
                  path: ProfileScreen.routeName,
                  maintainState: false,
                ),
              ],
            ),
          ],
        ),

How can I manage route navigation when app started?

Shreemanarjun commented 6 months ago

You can use guards (https://pub.dev/packages/auto_route#route-guards).