Skip to content

Deprecate design libraries - #192957

Merged
auto-submit[bot] merged 8 commits into
flutter:masterfrom
Piinks:depDesign-3
Oct 3, 2026
Merged

auto-submit[bot] merged 8 commits into
flutter:masterfrom
Piinks:depDesign-3

Conversation

@Piinks

@Piinks Piinks commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Deprecates package:flutter/material.dart and package:flutter/cupertino.dart in favor of package:material_ui/material_ui.dart and package:cupertino_ui/cupertino_ui.dart, and verifies the dart fix library migrations.

  • Adds @Deprecated annotations to library material; (package:flutter/lib/material.dart) and library cupertino; (package:flutter/lib/cupertino.dart).

  • Deprecating the library declarations triggers the existing library-level replacedBy transforms in fix_material.yaml and fix_cupertino.yaml.

  • Updates the golden .expect files in packages/flutter/test_fixes/material/ and packages/flutter/test_fixes/cupertino/ to verify that dart fix migrates package:flutter/material.dart and package:flutter/cupertino.dart imports to package:material_ui/material_ui.dart and package:cupertino_ui/cupertino_ui.dart.

    Part of Investigate dart fix or other options for material/cupertino migration #172935

Pre-launch Checklist

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

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

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.

@Piinks
Piinks requested a review from justinmc September 17, 2026 22:20
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Sep 17, 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 deprecates the cupertino and material libraries in package:flutter in favor of package:cupertino_ui and package:material_ui, updating the migration transforms and test expect files accordingly. Feedback highlights that migrating these imports via dart fix will cause compilation errors for users unless the new packages are added to their dependencies. Additionally, several test expect files violate the directives_ordering lint rule because the imports are not sorted alphabetically.

Comment on lines +18 to +19
'Use package:material_ui/material_ui.dart instead. '
'This feature was deprecated after v3.47.0-0.0.pre.',

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.

high

Migrating imports from package:flutter/material.dart to package:material_ui/material_ui.dart via dart fix will cause compilation errors for users unless package:material_ui is also added to their pubspec.yaml dependencies. Since dart fix does not automatically add dependencies to pubspec.yaml during library-level migrations, users will experience broken builds immediately after running the fix. Please consider how this dependency transition will be managed or if a custom migration tool/documentation is needed to guide users to add the new dependency.

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.

Same comment here, this is fine.

Comment on lines +23 to +24
'Use package:cupertino_ui/cupertino_ui.dart instead. '
'This feature was deprecated after v3.47.0-0.0.pre.',

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.

high

Migrating imports from package:flutter/cupertino.dart to package:cupertino_ui/cupertino_ui.dart via dart fix will cause compilation errors for users unless package:cupertino_ui is also added to their pubspec.yaml dependencies. Since dart fix does not automatically add dependencies to pubspec.yaml during library-level migrations, users will experience broken builds immediately after running the fix. Please consider how this dependency transition will be managed or if a custom migration tool/documentation is needed to guide users to add the new dependency.

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.

dart fix will in fact add the depencency.

Comment on lines +5 to 6
import 'package:material_ui/material_ui.dart';
import 'package:flutter/services.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.

medium

The imports are not sorted alphabetically, which violates the directives_ordering lint rule. package:flutter/services.dart should come before package:material_ui/material_ui.dart.

import 'package:flutter/services.dart';
import 'package:material_ui/material_ui.dart';
References
  1. According to Effective Dart: Style, imports should be sorted alphabetically. The 'directives_ordering' lint rule enforces that 'package:flutter/services.dart' comes before 'package:material_ui/material_ui.dart'. (link)

Comment on lines +5 to 6
import 'package:material_ui/material_ui.dart';
import 'package:flutter/services.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.

medium

The imports are not sorted alphabetically, which violates the directives_ordering lint rule. package:flutter/services.dart should come before package:material_ui/material_ui.dart.

import 'package:flutter/services.dart';
import 'package:material_ui/material_ui.dart';
References
  1. According to Effective Dart: Style, imports should be sorted alphabetically. The 'directives_ordering' lint rule enforces that 'package:flutter/services.dart' comes before 'package:material_ui/material_ui.dart'. (link)

Comment on lines +5 to 6
import 'package:material_ui/material_ui.dart';
import 'package:flutter/services.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.

medium

The imports are not sorted alphabetically, which violates the directives_ordering lint rule. package:flutter/services.dart should come before package:material_ui/material_ui.dart.

import 'package:flutter/services.dart';
import 'package:material_ui/material_ui.dart';
References
  1. According to Effective Dart: Style, imports should be sorted alphabetically. The 'directives_ordering' lint rule enforces that 'package:flutter/services.dart' comes before 'package:material_ui/material_ui.dart'. (link)

@github-actions

Copy link
Copy Markdown

This pull request contains changes to Material or Cupertino, which are currently frozen in this repository.

Changes should be made in material_ui and/or cupertino_ui in the flutter/packages repository.

Please refer to #188444 for instructions.

@github-actions github-actions Bot added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages f: scrolling Viewports, list views, slivers, etc. c: tech-debt Technical debt, code quality, testing, etc. f: cupertino d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos labels Sep 17, 2026
@Piinks Piinks added the override code freeze Override an active code freeze. label Sep 17, 2026
@justinmc justinmc mentioned this pull request Sep 21, 2026
1 of 6 tasks
justinmc
justinmc previously approved these changes Sep 21, 2026

@justinmc justinmc 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.

LGTM. I closed my old draft PR #186915 in favor of this.

Comment on lines +18 to +19
'Use package:material_ui/material_ui.dart instead. '
'This feature was deprecated after v3.47.0-0.0.pre.',

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.

Same comment here, this is fine.

aayushkedawat pushed a commit to aayushkedawat/flutter that referenced this pull request Sep 21, 2026
…d` to `[material|cupertino]_ui` (flutter#193099)

Follow-up to flutter#192947 in preparation for deprecating
`package:flutter/material.dart` and `package:flutter/cupertino.dart`
Part of un-blocking flutter#192957

This PR migrates the remaining `flutter_tools` templates and test
fixtures that run `flutter analyze` so they do not trigger
`deprecated_member_use` diagnostics when the design libraries in
`package:flutter` are deprecated:

1. **module template**:
- Migrates `lib/main.dart.tmpl` and `test/widget_test.dart.tmpl` to
`material_ui`.
2. **widget_preview_scaffold**:
- Migrates the `widget_preview_scaffold` template files, hydrated
scaffold sources, and tests to `material_ui` and `cupertino_ui`.
3. **analyze_once_test.dart **:
- Migrates the synthetic `mainDartSrc` fixture from
`package:flutter/material.dart` to `package:flutter/widgets.dart`
(`WidgetsApp`), since `createDotPackages()` constructs a minimal
`.dart_tool/package_config.json` containing only `flutter` and
`sky_engine`.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant in-code documentation (doc comments with
`///`).
- [x] If this PR introduces a new feature or capability, I created and
linked a website documentation issue or PR in [flutter/website] (or
verified none is needed).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

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

If this change needs to override an active code freeze, provide a
comment explaining why. The code freeze workflow can be overridden by
code reviewers. See pinned issues for any active code freezes with
guidance.

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
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.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[flutter/website]: https://github.com/flutter/website
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Sep 21, 2026
Part of unblocking flutter/flutter#192957

## Pre-Review Checklist

**Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). 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.

[^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.
auto-submit Bot pushed a commit to flutter/tests that referenced this pull request Sep 29, 2026
Updates DevTools commit hash to [405689bc49f9c7ae0d7ca77b3d9b0f698745989b](flutter/devtools@405689b).

This incorporates flutter/devtools#10016 which migrates DevTools from `flutter/material.dart` to `material_ui/material_ui.dart` for flutter/flutter#192957.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
analyzer:
errors:

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.

why don't we migrate this app?

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.

@Piinks do you have context here? It looks like you originally intended to migrate it in aayushkedawat@638aae2.

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.

Weird, I thought I had done. Let me take a look.

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.

Yeah, I see no imports of flutter/material.dart or flutter/cupertino.dart under dev/integration_tests/widget_preview_scaffold/*
@justinmc did you add this? What was the failure?

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.

It looks like you added it in Piinks@630295d. Let me see if I can see a failure if I remove it.

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 my bad. I must have forgotten. When I put this up originally it was late at night in the hotel while I was in SVL. 😅

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.

Locally it seems all good if I remove that. I've pushed a commit so let's see if CI is ok.

auto-submit Bot pushed a commit to flutter/tests that referenced this pull request Oct 2, 2026
It was my mistake to disable these in #502 after missing a hash update on my flutter/flutter PR flutter/flutter#192957. These tests work correctly and pass after migration and should be enabled.

FYI @marcglasberg
auto-submit Bot pushed a commit to flutter/tests that referenced this pull request Oct 2, 2026
I'm trying to deprecate Material and Cupertino in flutter/flutter#192957. One of the things I was blocked on was that `provider` had not yet migrated. Now that it is migrated (rrousselGit/provider#924), this PR bumps the SHA, and the customer tests should pass in my migration PR.

Related:

 * #500
 * #499
@Piinks

Piinks commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

Woohoo! Looks like we're set!

@justinmc
justinmc requested a review from chunhtai October 2, 2026 20:41

@justinmc justinmc 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.

LGTM 👍 . This PR is half authored by me at this point, but I thought I might as well officially review it too :) I will also wait for @chunhtai's approval.

@chunhtai chunhtai 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.

LGTM

@Piinks Piinks added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 2, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Oct 2, 2026
Merged via the queue into flutter:master with commit b959896 Oct 3, 2026
22 of 23 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 3, 2026
@justinmc

justinmc commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

🎉 I will check in on this on Monday and keep an eye out for any unexpected consequences from this PR.

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

Labels

a: text input Entering text in a text field or keyboard related problems c: tech-debt Technical debt, code quality, testing, etc. CICD Run CI/CD d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos f: cupertino f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. override code freeze Override an active code freeze. p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants