New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix canpop logic to be more robust #73993
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -1483,10 +1483,14 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T | |||
|
|||
/// Whether this route can be popped. | |||
/// | |||
/// A route can be popped if there is at least one active route underneath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A route can be popped if there is at least one active route below it, or if [willHandlePopInternally] returns true.
/// When this changes, if the route is visible, the route will | ||
/// rebuild, and any widgets that used [ModalRoute.of] will be | ||
/// notified. | ||
bool get canPop => isActive && (!isFirst || willHandlePopInternally); | ||
bool get canPop => hasActiveRouteBelow || willHandlePopInternally; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is much easier to understand than the old version :-)
} | ||
return false; | ||
} | ||
_navigator!._history.cast<_RouteEntry?>().firstWhere( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is OK, although a for loop might have been simpler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
As title
Fixes #73956
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.