0

I have a native Splash Screen so no need to create a new one here and need to set LoginPage as default as well I have authenticated status than define which route to follow

so I set onGenerateRoute: (_) =>LoginPage.route(), and it loads twice in release and profile mode

                case AuthenticationStatus.authenticated:
                  _navigator.pushAndRemoveUntil<void>(
                      HomePage.route(),
                          (route) => false
                  );
                  break;
                case AuthenticationStatus.unauthenticated:
                  _navigator.pushAndRemoveUntil<void>(
                      LoginPage.route(),
                          (route) => false
                  );
                  break;
                default:
                  break;
...
  onGenerateRoute: (_) =>LoginPage.route(),

How to save the same logic but without double loading?

1 Answers1

0

I think the way your code is currently written is causing the double loading, your generateroute code should call a function and not a specific route. What I think is happening is that it checks unauthenticated, returns its route and then it checks the generate route, it re-returns the route again.

Denzel
  • 942
  • 5
  • 14