Skip to content

[go_router] Restore SDK app page adapters - #12924

Open
yazanmg wants to merge 18 commits into
flutter:mainfrom
yazanmg:fix-go-router-sdk-app-pages
Open

yazanmg wants to merge 18 commits into
flutter:mainfrom
yazanmg:fix-go-router-sdk-app-pages

Conversation

@yazanmg

@yazanmg yazanmg commented Sep 18, 2026

Copy link
Copy Markdown

Fixes flutter/flutter#192761.

go_router 18.x migrated its default Material and Cupertino adapters to material_ui and cupertino_ui. This left apps using the Flutter SDK's MaterialApp or CupertinoApp undetected in code paths that select default pages, hero controllers, and error screens.

This change restores support for the Flutter SDK app types while preserving the existing Material-over-Cupertino adapter precedence. Within each app family, the closest supported SDK or *_ui implementation is used so the page, hero controller, and default error screen stay within the same UI implementation.

Supported app implementations are:

  • Flutter SDK MaterialApp
  • material_ui.MaterialApp
  • Flutter SDK CupertinoApp
  • cupertino_ui.CupertinoApp

Nested-app regression tests verify that the existing Material-over-Cupertino precedence is preserved while selecting the matching SDK/*_ui implementation.

Coverage also verifies:

  • SDK and material_ui Material pages.
  • SDK and cupertino_ui Cupertino pages.
  • Material hero controller selection for both implementations.
  • Default error screens for all four app implementations.
  • App-type caches are invalidated when dependencies change.

Validation completed successfully:

  • Dart formatter passes for all changed Dart files.
  • The targeted SDK-app regression tests pass.
  • The full go_router test suite passes.

Pre-Review Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the AI contribution guidelines and understand my responsibilities, or I am not using AI tools.
  • I read the Tree Hygiene page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter.
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets.
  • I linked to at least one issue that this PR fixes in the description above.
  • I followed the version and CHANGELOG instructions.
  • I updated/added relevant documentation.
  • I added new tests to check the change I am making.
  • All existing and new tests are passing.

@yazanmg
yazanmg marked this pull request as ready for review September 18, 2026 18:12

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request restores support for SDK MaterialApp and CupertinoApp alongside material_ui and cupertino_ui packages by introducing an AppType enum to identify the closest app implementation in the widget tree and updating the builder, page builders, hero controllers, and error screens accordingly. The reviewer suggests clearing the cached _pageBuilderForAppType and _errorBuilderForAppType builders inside didChangeDependencies to ensure they are re-evaluated when context dependencies change.

Comment thread packages/go_router/lib/src/builder.dart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[go_router] 18.0.0 drops platform transitions for apps using the SDK MaterialApp (inverse of #191132)

1 participant