Skip to content

Conversation

@loic-sharma
Copy link
Member

@loic-sharma loic-sharma commented Jun 13, 2025

In the Flutter framework, only the foundation library is allowed to import package:meta. If other parts of the Flutter framework want to use package:meta, they must do so through the foundation library by exporting the desired package:meta member. This requirement is enforced through dev/bots/analyze.dart here.

This exports the internal attribute so that it can be used by the Flutter framework. This change was split off from #168437 as it might cause problems in google3 if there is code that imports both package:meta/meta.dart and package:flutter/foundation.dart.

I will get a test exemption.

Part of: #167668

Pre-launch Checklist

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

@loic-sharma loic-sharma requested a review from justinmc June 13, 2025 00:15
@github-actions github-actions bot added the framework flutter/packages/flutter repository. See also f: labels. label Jun 13, 2025
@loic-sharma loic-sharma marked this pull request as ready for review June 13, 2025 00:24
@loic-sharma
Copy link
Member Author

loic-sharma commented Jun 13, 2025

go_router will need to be updated before this can land: flutter/packages#9434

Copy link
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Could you explain in more detail why this has to be exported? I guess that since debugEnabledFeatureFlags will be marked as internal in your other PR, users that import debugEnabledFeatureFlags need to also import internal?

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@loic-sharma
Copy link
Member Author

loic-sharma commented Jun 13, 2025

@justinmc Good question! I added this to the PR description:

In the Flutter framework, only the foundation library is allowed to import package:meta. If other parts of the Flutter framework want to use package:meta, they must do so through the foundation library by exporting the desired package:meta member from the foundation library. This requirement is enforced through dev/bots/analyze.dart here.

It's not very clear to me why the Flutter framework has this package:meta restriction though.

@stuartmorgan-g
Copy link
Contributor

test-exempt: code refactor with no semantic change

(Based on Discord discussion, apparently the convention in the framework is that the exported surface is only important to the extent that it affects customer tests, and so even though this is effectively new public API, it's not something we directly enforce via tests.)

@loic-sharma loic-sharma force-pushed the foundation_export_internal branch from 8293502 to 52c5977 Compare June 23, 2025 23:13
@justinmc
Copy link
Contributor

@loic-sharma Just checking on this PR from triage, let me know if anything is still needed.

@loic-sharma loic-sharma added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 24, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Jun 24, 2025
@loic-sharma
Copy link
Member Author

Nope, this is good to go - submitting!

Merged via the queue into flutter:master with commit 5706259 Jun 24, 2025
68 of 69 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 24, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 25, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 25, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 25, 2025
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jun 26, 2025
Roll Flutter from d733bea to 2773c0c (42 revisions)

flutter/flutter@d733bea...2773c0c

2025-06-25 jason-simmons@users.noreply.github.com Log stack traces from exceptions thrown by devicelab test tasks (flutter/flutter#171165)
2025-06-25 mdebbar@google.com Revert "Move `web_long_running_tests_{1,5}_5` to `bringup`." (flutter/flutter#171100)
2025-06-25 bruno.leroux@gmail.com Add missing M3 tests for InputDecoration.isDense (flutter/flutter#171058)
2025-06-25 34871572+gmackall@users.noreply.github.com Add Android specific sub-step to validate the Android sdk path has no spaces (flutter/flutter#170829)
2025-06-24 737941+loic-sharma@users.noreply.github.com Update foundation library to export internal (flutter/flutter#170563)
2025-06-24 matanlurey@users.noreply.github.com Remove stale references to `Release-process.md` and `conductor` (flutter/flutter#171046)
2025-06-24 30870216+gaaclarke@users.noreply.github.com License cpp jun23 (flutter/flutter#171047)
2025-06-24 magder@google.com Add android-reviewers to CODEOWNERS (flutter/flutter#170157)
2025-06-24 srawlins@google.com Update tool/README.md regarding locally-built engine (flutter/flutter#171102)
2025-06-24 mdebbar@google.com [web] Align the PR triage process with the ecosystem's triage flow (flutter/flutter#171086)
2025-06-24 danny@tuppeny.com [flutter_tool] Migrate DAP off `ProcessUtils.writelnToStdinUnsafe` (flutter/flutter#171081)
2025-06-24 mdebbar@google.com [web] More granular configuration of the test environment (flutter/flutter#168767)
2025-06-24 127918074+salemiranloye@users.noreply.github.com Clean up Devfs_Web into separate files (flutter/flutter#170769)
2025-06-24 59215665+davidhicks980@users.noreply.github.com Add RawMenuAnchor animation callbacks (flutter/flutter#167806)
2025-06-24 jason-simmons@users.noreply.github.com Support wide gamut colors when applying a DlColor to an SkPaint (flutter/flutter#170613)
2025-06-24 nshahan@google.com Remove temporary workaround for web testing (flutter/flutter#170949)
2025-06-24 engine-flutter-autoroll@skia.org Roll Packages from 02770da to d9d3191 (6 revisions) (flutter/flutter#171075)
2025-06-24 15619084+vashworth@users.noreply.github.com Add LLDB warnings (flutter/flutter#170827)
2025-06-24 bruno.leroux@gmail.com Update FormField.initialValue documentation (flutter/flutter#171061)
2025-06-24 engine-flutter-autoroll@skia.org Roll Skia from 132cb2052565 to a462e701b493 (2 revisions) (flutter/flutter#171063)
2025-06-24 engine-flutter-autoroll@skia.org Roll Skia from f88706e3a863 to 132cb2052565 (4 revisions) (flutter/flutter#171057)
2025-06-24 zeqinjie@qq.com When maintainHintSize is false, hint is centered and aligned, it is different from the original one (flutter/flutter#168654)
2025-06-24 bruno.leroux@gmail.com Deprecate DropdownButtonFormField "value" parameter in favor of "initialValue" (flutter/flutter#170805)
2025-06-24 engine-flutter-autoroll@skia.org Roll Skia from af6feb799ea6 to f88706e3a863 (2 revisions) (flutter/flutter#171056)
2025-06-24 engine-flutter-autoroll@skia.org Roll Dart SDK from aebd78999b1a to d9edd9e7a634 (1 revision) (flutter/flutter#171053)
2025-06-24 engine-flutter-autoroll@skia.org Roll Skia from ae517eba0170 to af6feb799ea6 (1 revision) (flutter/flutter#171052)
2025-06-24 engine-flutter-autoroll@skia.org Roll Skia from a7735d517e6a to ae517eba0170 (9 revisions) (flutter/flutter#171049)
2025-06-24 rmacnak@google.com Enable interpretation fallback when unable to JIT on iOS. (flutter/flutter#170835)
2025-06-24 kevmoo@users.noreply.github.com Flutter test cleanup (flutter/flutter#170891)
2025-06-24 matanlurey@users.noreply.github.com Move `packages_autoroller` out of the carcass of `conductor`, delete `conductor` (flutter/flutter#171029)
2025-06-23 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Don't strip symbols from `libapp.so` on android by default (#162464)" (flutter/flutter#171044)
2025-06-23 engine-flutter-autoroll@skia.org Roll Dart SDK from a09de0d3556c to aebd78999b1a (2 revisions) (flutter/flutter#171039)
2025-06-23 34871572+gmackall@users.noreply.github.com Don't strip symbols from `libapp.so` on android by default (flutter/flutter#162464)
2025-06-23 engine-flutter-autoroll@skia.org Roll Skia from 0311837abe86 to a7735d517e6a (12 revisions) (flutter/flutter#171037)
2025-06-23 bungeman@chromium.org Pass font scanner to font mgr that need it (flutter/flutter#170701)
2025-06-23 jacksongardner@google.com Make service worker tests more lenient. (flutter/flutter#170939)
2025-06-23 737941+loic-sharma@users.noreply.github.com Remove update CHANGELOG step from stable cherry pick process (flutter/flutter#171017)
2025-06-23 15619084+vashworth@users.noreply.github.com Include dev_dependencies in all builds for iOS and macOS (flutter/flutter#171015)
2025-06-23 matanlurey@users.noreply.github.com Move `web_long_running_tests_{1,5}_5` to `bringup`. (flutter/flutter#171026)
2025-06-23 muhatashim@google.com rename from announce to supportsAnnounce on engine (flutter/flutter#170618)
2025-06-23 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#171016)
2025-06-23 azat24680@gmail.com Enhance Text Contrast for WCAG AAA Compliance (flutter/flutter#170758)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
...
mboetger pushed a commit to mboetger/flutter that referenced this pull request Jul 21, 2025
In the Flutter framework, only the `foundation` library is allowed to
import `package:meta`. If other parts of the Flutter framework want to
use `package:meta`, they must do so through the `foundation` library by
exporting the desired `package:meta` member. This requirement is
enforced through `dev/bots/analyze.dart`
[here](https://github.com/flutter/flutter/blob/master/dev/bots/analyze.dart#L2749-L2750).

This exports the `internal` attribute so that it can be used by the
Flutter framework. This change was split off from
flutter#168437 as it might cause
problems in google3 if there is code that imports both
`package:meta/meta.dart` and `package:flutter/foundation.dart`.

I will get a test exemption.

Part of: flutter#167668

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [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 documentation (doc comments with `///`).
- [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].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[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
[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
vashworth pushed a commit to vashworth/packages that referenced this pull request Jul 30, 2025
Roll Flutter from d733bea to 2773c0c (42 revisions)

flutter/flutter@d733bea...2773c0c

2025-06-25 jason-simmons@users.noreply.github.com Log stack traces from exceptions thrown by devicelab test tasks (flutter/flutter#171165)
2025-06-25 mdebbar@google.com Revert "Move `web_long_running_tests_{1,5}_5` to `bringup`." (flutter/flutter#171100)
2025-06-25 bruno.leroux@gmail.com Add missing M3 tests for InputDecoration.isDense (flutter/flutter#171058)
2025-06-25 34871572+gmackall@users.noreply.github.com Add Android specific sub-step to validate the Android sdk path has no spaces (flutter/flutter#170829)
2025-06-24 737941+loic-sharma@users.noreply.github.com Update foundation library to export internal (flutter/flutter#170563)
2025-06-24 matanlurey@users.noreply.github.com Remove stale references to `Release-process.md` and `conductor` (flutter/flutter#171046)
2025-06-24 30870216+gaaclarke@users.noreply.github.com License cpp jun23 (flutter/flutter#171047)
2025-06-24 magder@google.com Add android-reviewers to CODEOWNERS (flutter/flutter#170157)
2025-06-24 srawlins@google.com Update tool/README.md regarding locally-built engine (flutter/flutter#171102)
2025-06-24 mdebbar@google.com [web] Align the PR triage process with the ecosystem's triage flow (flutter/flutter#171086)
2025-06-24 danny@tuppeny.com [flutter_tool] Migrate DAP off `ProcessUtils.writelnToStdinUnsafe` (flutter/flutter#171081)
2025-06-24 mdebbar@google.com [web] More granular configuration of the test environment (flutter/flutter#168767)
2025-06-24 127918074+salemiranloye@users.noreply.github.com Clean up Devfs_Web into separate files (flutter/flutter#170769)
2025-06-24 59215665+davidhicks980@users.noreply.github.com Add RawMenuAnchor animation callbacks (flutter/flutter#167806)
2025-06-24 jason-simmons@users.noreply.github.com Support wide gamut colors when applying a DlColor to an SkPaint (flutter/flutter#170613)
2025-06-24 nshahan@google.com Remove temporary workaround for web testing (flutter/flutter#170949)
2025-06-24 engine-flutter-autoroll@skia.org Roll Packages from 02770da to d9d3191 (6 revisions) (flutter/flutter#171075)
2025-06-24 15619084+vashworth@users.noreply.github.com Add LLDB warnings (flutter/flutter#170827)
2025-06-24 bruno.leroux@gmail.com Update FormField.initialValue documentation (flutter/flutter#171061)
2025-06-24 engine-flutter-autoroll@skia.org Roll Skia from 132cb2052565 to a462e701b493 (2 revisions) (flutter/flutter#171063)
2025-06-24 engine-flutter-autoroll@skia.org Roll Skia from f88706e3a863 to 132cb2052565 (4 revisions) (flutter/flutter#171057)
2025-06-24 zeqinjie@qq.com When maintainHintSize is false, hint is centered and aligned, it is different from the original one (flutter/flutter#168654)
2025-06-24 bruno.leroux@gmail.com Deprecate DropdownButtonFormField "value" parameter in favor of "initialValue" (flutter/flutter#170805)
2025-06-24 engine-flutter-autoroll@skia.org Roll Skia from af6feb799ea6 to f88706e3a863 (2 revisions) (flutter/flutter#171056)
2025-06-24 engine-flutter-autoroll@skia.org Roll Dart SDK from aebd78999b1a to d9edd9e7a634 (1 revision) (flutter/flutter#171053)
2025-06-24 engine-flutter-autoroll@skia.org Roll Skia from ae517eba0170 to af6feb799ea6 (1 revision) (flutter/flutter#171052)
2025-06-24 engine-flutter-autoroll@skia.org Roll Skia from a7735d517e6a to ae517eba0170 (9 revisions) (flutter/flutter#171049)
2025-06-24 rmacnak@google.com Enable interpretation fallback when unable to JIT on iOS. (flutter/flutter#170835)
2025-06-24 kevmoo@users.noreply.github.com Flutter test cleanup (flutter/flutter#170891)
2025-06-24 matanlurey@users.noreply.github.com Move `packages_autoroller` out of the carcass of `conductor`, delete `conductor` (flutter/flutter#171029)
2025-06-23 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Don't strip symbols from `libapp.so` on android by default (#162464)" (flutter/flutter#171044)
2025-06-23 engine-flutter-autoroll@skia.org Roll Dart SDK from a09de0d3556c to aebd78999b1a (2 revisions) (flutter/flutter#171039)
2025-06-23 34871572+gmackall@users.noreply.github.com Don't strip symbols from `libapp.so` on android by default (flutter/flutter#162464)
2025-06-23 engine-flutter-autoroll@skia.org Roll Skia from 0311837abe86 to a7735d517e6a (12 revisions) (flutter/flutter#171037)
2025-06-23 bungeman@chromium.org Pass font scanner to font mgr that need it (flutter/flutter#170701)
2025-06-23 jacksongardner@google.com Make service worker tests more lenient. (flutter/flutter#170939)
2025-06-23 737941+loic-sharma@users.noreply.github.com Remove update CHANGELOG step from stable cherry pick process (flutter/flutter#171017)
2025-06-23 15619084+vashworth@users.noreply.github.com Include dev_dependencies in all builds for iOS and macOS (flutter/flutter#171015)
2025-06-23 matanlurey@users.noreply.github.com Move `web_long_running_tests_{1,5}_5` to `bringup`. (flutter/flutter#171026)
2025-06-23 muhatashim@google.com rename from announce to supportsAnnounce on engine (flutter/flutter#170618)
2025-06-23 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#171016)
2025-06-23 azat24680@gmail.com Enhance Text Contrast for WCAG AAA Compliance (flutter/flutter#170758)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
...
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2025
@eseidel
Copy link
Contributor

eseidel commented Sep 5, 2025

Btw, changing this export list can cause some confusion if you have a project which is intended to build with multiple versions of Flutter. Because now that 3.35.x includes this export, the analyzer will remove (I think?) the package:meta import you previously had, causing your sources to now only compile with Flutter 3.35.0 or later, even if you wanted to be able to compile with more than that.

I'm not sure that matters a ton? But it came up today with a Shorebird customer. shorebirdtech/shorebird#3300

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

Labels

framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants