检查popUntil是否可能/检查导航堆栈中的命名路线

时间:2020-04-07 08:01:33

标签: flutter

如何查看导航堆栈中是否有名称为d = lambda x: f'Product{x+1}' df = (df.join(df['Products'].str.split('\s+\+\s+', expand=True) .rename(columns=d) .fillna(''))) print (df) ID Products Product1 Product2 Product3 Product4 Product5 0 1 A + B + C + D + E A B C D E 1 2 A + F + G A F G 2 3 X + D X D 的路线?每当我调用workout且路由不在堆栈中时,都会得到:

popUntil

我已经尝试过了,但是 ════════ Exception caught by widgets library ═══════════════════════════════════ The following assertion was thrown building Navigator-[GlobalObjectKey<NavigatorState> _WidgetsAppState#9d229](dirty, state: NavigatorState#86712(tickers: tracking 2 tickers)): 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 2330 pos 12: '!_debugLocked': is not true. Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause. In either case, please report this assertion by filing a bug on GitHub: https://github.com/flutter/flutter/issues/new?template=BUG.md The relevant error-causing widget was MaterialApp lib/main.dart:58 When the exception was thrown, this was the stack #2 NavigatorState.build package:flutter/…/widgets/navigator.dart:2330 #3 StatefulElement.build package:flutter/…/widgets/framework.dart:4334 仍然抛出异常

popUntil

1 个答案:

答案 0 :(得分:0)

如果您要清除整个堆栈并显示特定的屏幕,则应尝试以下代码:

Navigator.of(context).pushNamedAndRemoveUntil('/ screen4',(Route route)=> false);

它应该做的工作。