调用Navigator.pushAndRemoveUntil或Navigator.pushReplacement时,这两处断言会失败。虽然有BoostNavigator.pushReplacement方法,但是改造成本比较大。且,没有BoostNavigator.pushAndRemoveUntil方法,无法进行清栈处理。怎么解?
boost:4.0.4(前几个版本应该也差不多的情况)
flutter:3.3.1(前几个版本应该也差不多的情况)
// Route is removed without being completed.
void remove({ bool isReplaced = false }) {
assert(
!hasPage || isWaitingForExitingDecision,
'A page-based route cannot be completed using imperative api, provide a '
'new list without the corresponding Page to Navigator.pages instead. ',
);
......
}
// Route completes with result
and is removed.
void complete(T result, { bool isReplaced = false }) {
assert(
!hasPage || isWaitingForExitingDecision,
'A page-based route cannot be completed using imperative api, provide a '
'new list without the corresponding Page to Navigator.pages instead. ',
);
......
}
据排查,发现当前页面是BoostPage时,hasPage==true,所以断言失败
1条答案
按热度按时间kpbpu0081#
谢谢反馈,请问可以在flutterboost的example里提供一个可复现的demo吗?