Repository navigation
Deprecate design libraries - #192957
Deprecate design libraries#192957
Conversation
There was a problem hiding this comment.
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.
| 'Use package:material_ui/material_ui.dart instead. ' | ||
| 'This feature was deprecated after v3.47.0-0.0.pre.', |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Same comment here, this is fine.
| 'Use package:cupertino_ui/cupertino_ui.dart instead. ' | ||
| 'This feature was deprecated after v3.47.0-0.0.pre.', |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
dart fix will in fact add the depencency.
| import 'package:material_ui/material_ui.dart'; | ||
| import 'package:flutter/services.dart'; |
There was a problem hiding this comment.
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
- 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)
| import 'package:material_ui/material_ui.dart'; | ||
| import 'package:flutter/services.dart'; |
There was a problem hiding this comment.
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
- 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)
| import 'package:material_ui/material_ui.dart'; | ||
| import 'package:flutter/services.dart'; |
There was a problem hiding this comment.
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
- 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)
|
This pull request contains changes to Material or Cupertino, which are currently frozen in this repository. Changes should be made in Please refer to #188444 for instructions. |
| 'Use package:material_ui/material_ui.dart instead. ' | ||
| 'This feature was deprecated after v3.47.0-0.0.pre.', |
There was a problem hiding this comment.
Same comment here, this is fine.
…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
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.
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: |
There was a problem hiding this comment.
why don't we migrate this app?
There was a problem hiding this comment.
@Piinks do you have context here? It looks like you originally intended to migrate it in aayushkedawat@638aae2.
There was a problem hiding this comment.
Weird, I thought I had done. Let me take a look.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
It looks like you added it in Piinks@630295d. Let me see if I can see a failure if I remove it.
There was a problem hiding this comment.
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. 😅
There was a problem hiding this comment.
Locally it seems all good if I remove that. I've pushed a commit so let's see if CI is ok.
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
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
|
Woohoo! Looks like we're set! |
|
🎉 I will check in on this on Monday and keep an eye out for any unexpected consequences from this PR. |
Deprecates
package:flutter/material.dartandpackage:flutter/cupertino.dartin favor ofpackage:material_ui/material_ui.dartandpackage:cupertino_ui/cupertino_ui.dart, and verifies thedart fixlibrary migrations.Adds
@Deprecatedannotations tolibrary material;(package:flutter/lib/material.dart) andlibrary cupertino;(package:flutter/lib/cupertino.dart).Deprecating the
librarydeclarations triggers the existing library-levelreplacedBytransforms infix_material.yamlandfix_cupertino.yaml.Updates the golden
.expectfiles inpackages/flutter/test_fixes/material/andpackages/flutter/test_fixes/cupertino/to verify thatdart fixmigratespackage:flutter/material.dartandpackage:flutter/cupertino.dartimports topackage:material_ui/material_ui.dartandpackage:cupertino_ui/cupertino_ui.dart.Part of Investigate
dart fixor other options for material/cupertino migration #172935Pre-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-assistbot 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.