Skip to content

fix: Call onPop when a ValueRoute is popped - #4286

Merged
spydon merged 2 commits into
flame-engine:mainfrom
turalbabayev:fix/value-route-on-pop
Dec 2, 2026
Merged

spydon merged 2 commits into
flame-engine:mainfrom
turalbabayev:fix/value-route-on-pop

Conversation

@turalbabayev

Copy link
Copy Markdown
Contributor

Description

ValueRoute.didPop completes the future with the default value but doesn't call super.didPop. Because Route.didPop is what calls onPop, a ValueRoute subclass gets onPush but never onPop. For example, a dialog route that pauses the game in onPush and resumes it in onPop stays paused after it closes. The override is already marked @mustCallSuper.

didPop now calls super.didPop(nextRoute) before it completes the future.

New test in value_route_test.dart: "calls onPush and onPop" pushes a ValueRoute with pushAndWait, completes it, and checks that both callbacks ran with the right routes. It fails on main (only onPush runs) and passes here.

Checked locally on macOS with Flutter 3.50.1: dart format reports no changes, flutter analyze reports no issues, cspell finds nothing, and flutter test in packages/flame passes except for the same 8 golden tests that also fail on main on this machine.

Checklist

  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • [-] I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • [-] I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Related Issues

None.

@spydon
spydon enabled auto-merge December 2, 2026 16:13
@spydon
spydon added this pull request to the merge queue Dec 2, 2026
Merged via the queue into flame-engine:main with commit 4a6fcc5 Dec 2, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants