Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Remove dependencies on 'meta' #4647

Merged
merged 14 commits into from
Jan 10, 2022
Merged

Conversation

stuartmorgan
Copy link
Contributor

Flutter re-exports everything from meta that we actually use, and all plugins by definition require Flutter, so there's no need to use meta instead of Flutter to access common annotations (e.g., immutable, visibleForTesting).

This removes all use of meta, as well as dependencies on the package, from all plugins.

Fixes flutter/flutter#95658

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

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.

@Hixie
Copy link
Contributor

Hixie commented Jan 6, 2022

We actually do have a test for this in the flutter/flutter repo, FWIW. It just reads every Dart file and checks for the banned imports.

test-exempt: code refactor with no semantic change

@stuartmorgan
Copy link
Contributor Author

We actually do have a test for this in the flutter/flutter repo, FWIW. It just reads every Dart file and checks for the banned imports.

I had considered this, but presumably there could be cases where we'd want to use something from meta that Flutter doesn't happen to re-export, so an outright ban didn't seem like the right behavior. (I guess in theory we could make it a complicated check that only allowed import 'meta/meta.dart' show <things not in a list of banned items>...)

@Hixie
Copy link
Contributor

Hixie commented Jan 6, 2022

We could also just require that anything we want to use has to be re-exported from foundation. But I don't feel strongly about this either way.

@godofredoc godofredoc changed the base branch from master to main January 6, 2022 22:08
@ditman
Copy link
Member

ditman commented Jan 7, 2022

I wish this could be done with:

meta:
  sdk: flutter

That way we don't have to remember the random place from which the framework reexports the meta pkg :/

Copy link
Contributor

@bparrishMines bparrishMines left a comment

Choose a reason for hiding this comment

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

LGTM once pubspecs and CHANGELOGs are updated

@Hixie
Copy link
Contributor

Hixie commented Jan 8, 2022

That way we don't have to remember the random place from which the framework reexports the meta pkg :/

It's not really that random, it's the foundation package of the core framework. :-)

Copy link
Contributor

@cyanglaz cyanglaz left a comment

Choose a reason for hiding this comment

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

LGTM

@stuartmorgan stuartmorgan merged commit a0b7daa into flutter:main Jan 10, 2022
@stuartmorgan stuartmorgan deleted the remove-meta branch January 10, 2022 18:42
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 10, 2022
proninyaroslav pushed a commit to proninyaroslav/plugins that referenced this pull request Jan 10, 2022
Flutter re-exports everything from meta that we actually use, and all plugins by definition require Flutter, so there's no need to use `meta` instead of Flutter to access common annotations (e.g., immutable, visibleForTesting).

This removes all use of `meta`, as well as dependencies on the package, from all plugins.

Fixes flutter/flutter#95658
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove meta dependencies from plugins where possible
5 participants