主屏幕加载两次
我有一个本机的飞溅屏幕,因此无需在此处创建一个新的屏幕,并且需要将登录页设置为默认 我还具有身份验证的状态,而不是定义要遵循的途径
,所以我设置了onGenerateroute:(_)=> loginpage.route(),它在版本中加载了两次, Release 和 profile 模式
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(),
如何保存相同的逻辑但没有双重加载?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您的代码当前正在编写的方式导致双重加载,您的
Generateroute
代码应调用功能而不是特定路由。我认为正在发生的事情是,它检查
未经验证的
,返回其路线,然后检查生成路由,然后再次重新返回路线。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.