问题描述
在我的应用程序中,我有三个屏幕,分别是login,verifyotp,generatepass.我知道如何从一页移动到另一页,例如: Navigator.pushNamed(context,"/theNameOfThePage");
.我有一个流程,我从login-> verifyotp-> generatepass移动,现在我的问题是如何从generatepass移至登录页面并清除所有堆栈.我是一名Android开发人员,因此在android中,我们有 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
.我如何在颤抖中获得相同的结果!
In my app i have three screens login , verifyotp , generatepass. I know how to move from one page to other page eg: Navigator.pushNamed(context, "/theNameOfThePage");
.I have a flow in which i move from login->verifyotp->generatepass my question is now how can i move from generatepass to login page and clearing all the stack.I am an android developer so in android we have intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
.How can i achieve same result in flutter!
推荐答案
完全清除Navigator的历史记录并导航到新路线:
Full clean of Navigator's history and navigate to new route:
void _logout() {
Navigator.pushNamedAndRemoveUntil(context, "/newRouteName", (r) => false);
}
这篇关于导航器路线清除抖动堆栈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!