flutter_boost icon indicating copy to clipboard operation
flutter_boost copied to clipboard

项目中原来的Navigator的pushAndRemoveUntil或pushReplacement方法调用失败

Open SimonYeyi opened this issue 2 years ago • 2 comments

调用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>(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,所以断言失败

SimonYeyi avatar Sep 14 '22 02:09 SimonYeyi

谢谢反馈,请问可以在flutterboost的example里提供一个可复现的demo吗?

0xZOne avatar Sep 24 '22 15:09 0xZOne

遇到了同样的问题, 请求有解决思路吗

zhang-yawei avatar Apr 19 '24 11:04 zhang-yawei