fix(routing): resolve intermittent page title loss on web#53
Merged
anilcancakir merged 1 commit intomasterfrom Apr 7, 2026
Merged
fix(routing): resolve intermittent page title loss on web#53anilcancakir merged 1 commit intomasterfrom
anilcancakir merged 1 commit intomasterfrom
Conversation
Flutter's internal Title widget was overwriting TitleManager's route-level title via didChangeDependencies() on InheritedWidget changes (MediaQuery, Locale, Theme). Replace static title parameter with onGenerateTitle that delegates to TitleManager.effectiveTitle.
1143b49 to
a2f9b99
Compare
There was a problem hiding this comment.
Pull request overview
Fixes an intermittent Flutter web page-title regression where Flutter’s internal Title widget could overwrite Magic’s route-level titles, and updates the codebase for file_picker v11’s breaking API change.
Changes:
- Switch
MaterialApp.routerfrom a statictitle:toonGenerateTitlebacked byTitleManager.instance.effectiveTitleto keep Flutter’sTitlewidget aligned with route-level title updates. - Upgrade
file_pickerto^11.0.2and migrate facade call sites fromFilePicker.platform.*to the new staticFilePicker.*APIs. - Update changelog and example lockfile to reflect the dependency/version updates.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pubspec.yaml | Bumps file_picker dependency to ^11.0.2. |
| lib/src/foundation/magic_app_widget.dart | Uses onGenerateTitle to prevent Flutter’s Title widget from clobbering TitleManager titles on web dependency changes. |
| lib/src/facades/pick.dart | Migrates file picking calls to file_picker v11 static APIs. |
| example/pubspec.lock | Updates resolved package versions/hashes for the example app after dependency changes. |
| CHANGELOG.md | Documents the routing title fix and the file_picker upgrade under Unreleased. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Titlewidget was overwriting TitleManager's route-level title viadidChangeDependencies()on InheritedWidget changes (MediaQuery, Locale, Theme)MaterialApp.router(title:)withonGenerateTitlethat delegates toTitleManager.instance.effectiveTitlefile_pickerupgrade from^10.3.10to^11.0.2(static API migration, Android CWE-22 security fix)Root Cause
MagicApplicationpassed a statictitletoMaterialApp.router, which Flutter wraps in aTitlewidget. On web,Title.didChangeDependencies()fires on every InheritedWidget change and callsSystemChrome.setApplicationSwitcherDescriptionwith the static base title — overwriting TitleManager's route-level title. The race is intermittent because it depends on timing of MediaQuery/Locale/Theme updates during initial page load.Changes
lib/src/foundation/magic_app_widget.dart:210—title: widget.title→onGenerateTitle: (_) => TitleManager.instance.effectiveTitlelib/src/facades/pick.dart— MigrateFilePicker.platform.method()→FilePicker.method()(4 call sites)pubspec.yaml—file_picker: ^10.3.10→^11.0.2Test plan
flutter test— 914 tests passedflutter test test/routing/title_manager_test.dart— 30 tests passeddart analyze— zero warningsdart format . --set-exit-if-changed— zero changesCloses #44 (Dependabot file_picker PR — superseded by this PR which includes both the version bump and breaking API migration).