Skip to content

[go_router] migrates to material_ui and cupertino_ui - #12504

Open
chunhtai wants to merge 4 commits into
flutter:mainfrom
chunhtai:issues/191133
Open

[go_router] migrates to material_ui and cupertino_ui#12504
chunhtai wants to merge 4 commits into
flutter:mainfrom
chunhtai:issues/191133

Conversation

@chunhtai

@chunhtai chunhtai commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

fixes flutter/flutter#191133
fixes flutter/flutter#191132

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Aug 18, 2026

@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 updates the minimum supported SDK version to Flutter 3.44/Dart 3.12, simplifies several constructor initializations using initializing formals, and replaces imports of the official Flutter SDK Material library with a third-party material_ui package across the codebase, examples, and tests. Feedback indicates that migrating to the third-party material_ui package is incorrect for a core Flutter package and its examples, and these changes should be reverted to use the official Material library.

Comment on lines 18 to 20
logging: ^1.0.0
material_ui: ^1.0.0
meta: ^1.7.0

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.

critical

Adding material_ui as a dependency is incorrect. go_router is a core Flutter package and must rely on the official Material library (package:flutter/material.dart) provided by the Flutter SDK rather than an external third-party package.

  logging: ^1.0.0\n  meta: ^1.7.0

// ignore_for_file: diagnostic_describe_all_properties

import 'package:flutter/material.dart';
import 'package:material_ui/material_ui.dart';

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.

critical

Replacing package:flutter/material.dart with package:material_ui/material_ui.dart is incorrect. Please revert this import to use the official Flutter SDK Material library.

Suggested change
import 'package:material_ui/material_ui.dart';
import 'package:flutter/material.dart';

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.

lol. Get with the times. :)

Comment on lines 18 to 20
logging: ^1.0.0
material_ui: ^1.0.0
shared_preferences: ^2.0.11

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.

critical

Adding material_ui as a dependency in the example is incorrect. The example should use the official Flutter SDK Material library.

  logging: ^1.0.0\n  shared_preferences: ^2.0.11

- [State restoration](https://pub.dev/documentation/go_router/latest/topics/State%20restoration-topic.html)

## Migration Guides
- [Migrating to 18.0.0](https://flutter.dev/go/go-router-v18-breaking-changes).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@github-actions github-actions Bot added p: go_router triage-framework Should be looked at in framework triage labels Aug 18, 2026
@@ -4,8 +4,8 @@

import 'package:collection/collection.dart';
import 'package:flutter/cupertino.dart';

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.

This PR doesn't complete the job. There are two parts to the split - one is material_ui, and the other is cupertino_ui, and these need to be migrated as well.

@jonmountjoy

Copy link
Copy Markdown
Contributor

@chunhtai unfortunately I suspect that this migration (great start) is incomplete. It misses completely all the cupertino => cupertino_ui (mirroring the Material), which will play a role in things like the following working correctly:

bool isCupertinoApp(BuildContext context) =>

@Piinks

Piinks commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Yes, this should adopt cupertino_ui as well.

@chunhtai

Copy link
Copy Markdown
Contributor Author

oh i totally missed that. thanks for reminding

@chunhtai chunhtai changed the title [go_router] migrates to material_ui [go_router] migrates to material_ui and cupertino_ui Aug 19, 2026
@chunhtai
chunhtai requested a review from jonmountjoy August 19, 2026 17:01
@chunhtai

Copy link
Copy Markdown
Contributor Author

ready for another look

sdk: ^3.10.0
flutter: ">=3.38.0"
sdk: ^3.12.0
flutter: ">=3.44.0"

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.

I wonder about this, @chunhtai . Should it be 3.44.0?
I mean the material_ui/cupertino_ui split only came in 3.47.0

Maybe it's backward compatible? I have no idea.

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.

I see the cupertino_ui says it's compatible from 3.44.0 - so perhaps this is good to go...
https://github.com/flutter/packages/blob/main/packages/cupertino_ui/pubspec.yaml

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was following this comment in this pr #12467 (comment)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

oh this is to match the lower bound for material_ui

flutter: ">=3.44.0"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD p: go_router triage-framework Should be looked at in framework triage

Projects

None yet

3 participants