alibaba / alibaba/flutter_boost

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

Open
#1,713 2 comments 1 reaction 0 assignees View on GitHub
demo code needed
Dominant language
Dart
Stars
7.2k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the failure with Flutter 3.3.1 and flutter_boost 4.0.4 using Navigator.pushAndRemoveUntil and Navigator.pushReplacement on a BoostPage. Read the BoostNavigator and BoostPage handling of page-based routes, especially the hasPage assertions. Done means replacement works without the assertion and an equivalent stack-clearing operation is available.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.