Skip to content

Commit

Permalink
Fix new route pop logic
Browse files Browse the repository at this point in the history
  • Loading branch information
narumi147 committed Aug 17, 2024
1 parent 5c3d218 commit 4d0d792
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions lib/app/routes/delegate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ class AppRouterDelegate extends RouterDelegate<RouteConfiguration>

// only called when [Page] found
void onPopPage(Page page) {
assert(_history.contains(page));
if (canPop()) {
for (int index = _history.length - 1; index >= 0; index--) {
if (_history[index] == page) {
Expand Down Expand Up @@ -216,11 +215,10 @@ class AppRouterDelegate extends RouterDelegate<RouteConfiguration>
// use `SplitRoute.isMaster`
void popDetails() {
while (canPop()) {
final lastEntry = _history.last;
final page = lastEntry;
final page = _history.last;
if (page.detail == true) {
_history.remove(lastEntry);
lastEntry.complete(null);
_history.remove(page);
page.complete(null);
} else {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/app/routes/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ class RouteConfiguration {

@override
String toString() {
return 'RouteConfiguration(url=$url, detail=$detail)';
return 'RouteConfiguration(url=$url, detail=$detail, child=$child)';
}

RouteConfiguration copyWith({
Expand Down

0 comments on commit 4d0d792

Please sign in to comment.