-
Notifications
You must be signed in to change notification settings - Fork 29.1k
[State Restoration] Navigator assert on non restorable routes returned by onGenerateInitialRoutes #73082
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
Conversation
This is due to the tree is left half broken and the test fail to tear it down. I remember I ran into this issue before, and the way i do it is to make sure the tree is restored before the test ends |
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, modulo nits and failing test
assert( | ||
_history.isNotEmpty, | ||
'All routes returned by onGenerateInitialRoutes are not restorable. ' | ||
'Please make sure that all routes returned in onGenerateInitialRoutes ' |
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.
'Please make sure that all routes returned in onGenerateInitialRoutes ' | |
'Please make sure that all routes returned from the onGenerateInitialRoutes ' |
_history.isNotEmpty, | ||
'All routes returned by onGenerateInitialRoutes are not restorable. ' | ||
'Please make sure that all routes returned in onGenerateInitialRoutes ' | ||
'have their RouteSettings defined with a name that is defined in the ' |
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.
'have their RouteSettings defined with a name that is defined in the ' | |
'have their RouteSettings defined with names that are defined in the ' |
Description
Fixes #72453.
However, I'm running into trouble writing the test. The
expect
statements catch the new assert I added, but there is another unrelated assert that throws somehow after the test function body is done executing, and I'm not sure how to catch it or stop it from happening. I've tried adding andawait
ing widgetpump
,pumpAndSettle
, evenpumpWidget
at the end of the test function, but I'm not sure what's going on and at this point I'm just trying random things to make the assert go away:Checklist
Before you create this PR, confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze --flutter-repo
) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.