8000 Dependency issues while trying to run legacy projects with Flutter 2 (issue with i18n support) · Issue #77491 · flutter/flutter · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Dependency issues while trying to run legacy projects with Flutter 2 (issue with i18n support) #77491

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sarbogast opened this issue Mar 6, 2021 · 37 comments
Labels
a: null-safety Support for Dart's null safety feature a: release Challenges faced when attempting to productionize an app c: regression It was better in the past than it is now customer: crowd Affects or could affect many people, though not necessarily a specific customer. found in release: 2.0 Found to occur in 2.0 has reproducible steps The issue has been confirmed reproducible and is ready to work on P0 Critical issues such as a build break or regression r: invalid Issue is closed as not valid team-ecosystem Owned by Ecosystem team

Comments

@sarbogast
Copy link

Steps to Reproduce

Here is a project I created with Flutter 1.22.6 and I am now trying to build with Flutter 2.0.1. It runs fine with Flutter 1.22.6. Unfortunately I can't even get to run flutter run with 2.0.1, because flutter pub get fails with the following error:

% flutter pub get
Running "flutter pub get" in blindly_copy...                    
Because blindly depends on flutter_localizations any from sdk which depends on intl 0.17.0, intl 0.17.0 is required.

So, because blindly depends on intl 0.16.1, version solving failed.
pub get failed (1; So, because blindly depends on intl 0.16.1, version solving failed.)

I used this guide on all my projects to implement internationalization, which is why all my projects depend on intl and flutter_localizations. But apparently Flutter 2 required version 0.17.0 of intl. So I upgrade this dependency to 0.17.0, and comment out dependency on date_time_picker that still needs to be updated to depend on intl 0.17.0, now I'm getting the following dependency issue:

% flutter pub get
Running "flutter pub get" in blindly_copy...                    
Because no versions of firebase_auth match >0.20.1 <0.21.0 and firebase_auth 0.20.1 depends on firebase_auth_web ^0.3.3, firebase_auth ^0.20.1 requires firebase_auth_web ^0.3.3.


Because firebase_auth_web 0.3.3 depends on intl ^0.16.1 and no versions of firebase_auth_web match >0.3.3 <0.4.0, firebase_auth_web ^0.3.3 requires intl ^0.16.1.
Thus, firebase_auth ^0.20.1 requires intl ^0.16.1.

So, because blindly depends on both intl ^0.17.0 and firebase_auth ^0.20.1, version solving failed.
pub get failed (1; So, because blindly depends on both intl ^0.17.0 and firebase_auth ^0.20.1, version solving failed.)

So now pretty much all of my Firebase dependencies need to be updated to be compatible with intl 0.17.0. Which I do, and now I'm getting an issue with url_launcher:

% flutter pub get
Running "flutter pub get" in blindly_copy...                    
Because no versions of url_launcher match >5.7.10 <6.0.0 and url_launcher 5.7.10 depends on url_launcher_platform_interface ^1.0.9, url_launcher ^5.7.10 requires url_launcher_platform_interface ^1.0.9.


And because no versions of url_launcher_platform_interface match >1.0.9 <2.0.0 and url_launcher_platform_interface 1.0.9 depends on plugin_platform_interface ^1.0.1, url_launcher ^5.7.10 requires plugin_platform_interface ^1.0.1.
And because firebase_core >=1.0.0 depends on firebase_core_platform_interface ^4.0.0 which depends on plugin_platform_interface ^2.0.0, url_launcher ^5.7.10 is incompatible with firebase_core >=1.0.0.

So, because blindly depends on both firebase_core ^1.0.0 and url_launcher ^5.7.10, version solving failed.
pub get failed (1; So, because blindly depends on both firebase_core ^1.0.0 and url_launcher ^5.7.10, version solving failed.)

So now I'm trying to update url_launcher to 6.0.2 so that it is compatible with Flutter 2. But now I'm getting an issue with google_fonts, so I update this one as well, but this one conflicts with validators that's not been updated. And it goes on and on like that and I can't get my build to run anymore.

And I see that on other similar projects, simply because flutter_localizations embedded in Flutter 2 depends on intl 0.17.0 which is incompatible with so many other dependencies.

For now, I downgraded Flutter to 1.22.6 so that my projects can build again. But is the solution just to wait for all the dependencies to be updated. Shouldn't old projects still build with the new version of Flutter without this?

Logs

% flutter doctor -v
[✓] Flutter (Channel stable, 2.0.1, on macOS 11.2.2 20D80 darwin-x64, locale fr-FR)
    • Flutter version 2.0.1 at /Users/sarbogast/fvm/versions/stable
    • Framework revision c5a4b4029c (il y a 2 jours), 2021-03-04 09:47:48 -0800
    • Engine revision 40441def69
    • Dart version 2.12.0

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/sarbogast/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Users/sarbogast/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.7042882/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Users/sarbogast/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.7042882/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] IntelliJ IDEA Ultimate Edition (version 2020.3.2)
    • IntelliJ at /Users/sarbogast/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 54.0.3
    • Dart plugin version 203.7759

[✓] VS Code (version 1.53.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.19.0

[✓] Connected device (2 available)
    • iPhone 12 Pro (mobile) • E85E5DC8-065D-4C10-9849-0C40CCB3C417 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 88.0.4324.192
    ! Error: Séjour is busy: Waiting for Device. Xcode will continue when Séjour is finished. (code -10)

! Doctor found issues in 1 category.
@lukeurban
Copy link

Had a similar situation. Even wondered if it would a good idea to create a project setting called “flutter version” to easily manage incremental updates and flutter changes.

@nt4f04uNd
Copy link
Member

if you want to use flutter 2 and face such issues, update all packages to latest versions. if you still get errors, use dependency_overrides which forces to use some version with no respect to transitive dependencies

@sarbogast
Copy link
Author

It's a never ending game of wack-a-mole. I tried to get rid of all the unmaintained deps and I end up with an incompatibility between the latest version of google_fonts and the latest version of Firebase, both maintained by Google. This is insane.

@pedromassangocode pedromassangocode added the in triage Presently being triaged by the triage team label Mar 8, 2021
@pedromassangocode
Copy link

Hi @sarbogast
For the flutter_localizations package, it is now part of the framework, so to avoid ints conflicts, your dependency should depend in the framework:

flutter_localizations:
  sdk: flutter

Of other dependencies, please try to upgrade them to their latest version and see if that works for you.
Thank you

@pedromassangocode pedromassangocode added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Mar 8, 2021
@lukeurban
Copy link
lukeurban commented Mar 8, 2021

I am trying to be able to run my flutter app on the newest Flutter. After some version fiddling I am ending up with:

pub get failed (1; So, because labplus depends on both http ^0.13.0 and firebase_analytics ^7.1.0, version solving failed.)

again both packages are maintained by Google. Unfortunately, I can't see an easy way out of this.

@sarbogast
Copy link
Author

@pedromassango I already tried that and I'm getting the same issue as @lukeurban: 2 packages maintained by Google incompatible with each other:

% flutter pub get
Running "flutter pub get" in blindly_copy...                    
Because google_fonts >=2.0.0-nullsafety.0 depends on http ^0.13.0 and firebase >=5.0.3 <9.0.0 depends on http >=0.11.3 <0.13.0, google_fonts >=2.0.0-nullsafety.0 is incompatible with firebase >=5.0.3 <9.0.0.


And because firebase_analytics >=7.1.0 depends on firebase_analytics_web ^0.2.0 which depends on firebase ^7.3.0, google_fonts >=2.0.0-nullsafety.0 is incompatible with firebase_analytics >=7.1.0.
So, because blindly depends on both firebase_analytics ^7.1.0 and google_fonts ^2.0.0, version solving failed.
pub get failed (1; So, because blindly depends on both firebase_analytics ^7.1.0 and google_fonts ^2.0.0, version solving failed.)

You can try it for yourself with my project here. All the dependencies are up-to-date, and flutter pub get still fails.

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Mar 8, 2021
@pedromassango
Copy link
Member

As suggested above, you can use dependecy overrides to avoid those conflicts!

@pedromassangocode
Copy link

2 packages maintained by Google incompatible with each other

Those packages are not part of the Flutter team's packages (they are third-party package/plugins), I would suggest you to file an issue in their related repositories and probably close this issue.

For Firebase related issues:
https://github.com/FirebaseExtended/flutterfire/issues

For Google Fonts:
https://github.com/material-foundation/google-fonts-flutter/

I don't think there is much the Flutter team can do to help with this.
Thank you

@pedromassangocode pedromassangocode added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Mar 9, 2021
@stuartmorgan-g
Copy link
Contributor

Shouldn't old projects still build with the new version of Flutter without this?

Ideally yes; the null-safety transition makes this much more challenging than usual though. In this case if the SDK constraint could be relaxed to allow either intl 0.16 or 0.17 that would avoid the cascading updates you encountered, but straddling major versions isn't always possible. I'm following up on whether it could be done in this case.

@stuartmorgan-g
Copy link
Contributor

@kevmoo In discussion with Hixie, he suggested that rather than trying to adjust the framework, we could see about querying for packages that depend on intl 0.16, and trying to reach out to them about doing minor updates that would just use 0.17 instead. Is that feasible?

@kevmoo
Copy link
Contributor
kevmoo commented Mar 9, 2021 via email

@pedromassango
Copy link
Member

we could see about querying for packages that depend on intl 0.16,

... and other packages as well. As a example the integration_test package will (eventually) cause this same issue once it lands the stable channel (as in the current dev channel it is now bundled in the framework), see #71379 (comment).

@benedictkhoo
Copy link
8000

@pedromassango I already tried that and I'm getting the same issue as @lukeurban: 2 packages maintained by Google incompatible with each other:

% flutter pub get
Running "flutter pub get" in blindly_copy...                    
Because google_fonts >=2.0.0-nullsafety.0 depends on http ^0.13.0 and firebase >=5.0.3 <9.0.0 depends on http >=0.11.3 <0.13.0, google_fonts >=2.0.0-nullsafety.0 is incompatible with firebase >=5.0.3 <9.0.0.


And because firebase_analytics >=7.1.0 depends on firebase_analytics_web ^0.2.0 which depends on firebase ^7.3.0, google_fonts >=2.0.0-nullsafety.0 is incompatible with firebase_analytics >=7.1.0.
So, because blindly depends on both firebase_analytics ^7.1.0 and google_fonts ^2.0.0, version solving failed.
pub get failed (1; So, because blindly depends on both firebase_analytics ^7.1.0 and google_fonts ^2.0.0, version solving failed.)

You can try it for yourself with my project here. All the dependencies are up-to-date, and flutter pub get still fails.

hi @sarbogast did you managed to resolve this? I had the same issue with firebase_analytics 7.1.0 and google_fonts 2.0.0. But there were new releases for FlutterFire dependencies a few days ago and I managed to resolve this by updating firebase_analytics to 7.1.1.

@lukeurban
Copy link

I have another issue with firebase packages flutterfire#5322. @benedictkhoo I am still waiting for the solution.

@pedromassango my app is live and I don't want to rush into temporary solutions as dependency overrides. I wish it to be resolved with a viable dependency connection. I'll wait with my upgrade. But thank you very much for the suggestion! ;)

@pedromassangocode

This comment has been minimized.

@pedromassangocode pedromassangocode added r: timeout Issue is closed due to author not providing the requested details in time and removed waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds labels Apr 7, 2021
@tvolkert tvolkert added a: null-safety Support for Dart's null safety feature a: release Challenges faced when attempting to productionize an app and removed in triage Presently being triaged by the triage team r: timeout Issue is closed due to author not providing the requested details in time labels Apr 8, 2021
@tvolkert
Copy link
Contributor
tvolkert commented Apr 8, 2021

Re-opening to track the ecosystem upgrade that needs to happen.

@tvolkert tvolkert reopened this Apr 8, 2021
@jakemac53
Copy link
Contributor

Note that you can override intl to ^0.17.0 as a temporary workaround, but that will in itself cause issues later down the line even if it happens to work right now:

dependency_overrides:
  intl: ^0.17.0

The root of the problem here though is sdk vendored packages which have pub package dependencies. NNBD definitely highlights this because of the large number of packages with breaking changes, but it will always be a potential version lock problem. Note that this is regardless of pinning or version constraints (in this case it would have been a ^0.17.0 dep anyways presumably, which would have the same problem).

That is a very difficult problem to solve, but if we want to resolve the core issue that is the place to start IMO.

@stuartmorgan-g
Copy link
Contributor

The root of the problem here though is sdk vendored packages which have pub package dependencies.

Yes, that was @Hixie's take as well.

Re-opening to track the ecosystem upgrade that needs to happen.

What's the actionable step for the Flutter project here? It's not clear to me what we can do with this issue (given that I believe we've ruled out hotfixing Flutter 2 to allow intl 0.16 given how risky that would be), or what the criteria for closing it would be.

@tvolkert
Copy link
Contributor
tvolkert commented Apr 8, 2021

@amirh had written a tool that was "like Rosie but for GitHub" - I wonder if we might be able to drive some updates to the newer intl in the ecosystem, since in some cases it may trivially pass without substantive code updates?

@stuartmorgan-g
Copy link
Contributor

There's at least one breaking change in called out in intl 0.17 in addition to potential breaking changes from the migration itself; trying to apply an LSC without knowing anything about whether the packages are affected by those breaking changes, or have sufficient test coverage that the PR would fail if they were, seems extremely risky.

@kevmoo Have you run the 0.16 query discussed above? Do we know how many packages are still using 0.16?

@stuartmorgan-g
Copy link
Contributor

I figured out how to extract this data from the pub APIs. The most common values are:

  25 ^0.15.8
  32 ^0.15.7
  75 ^0.16.0
 184 ^0.17.0
 202 ^0.16.1

Then there's a long tail that account for the rest. (Note that the 0.15.x versions already haven't been compatible with Flutter for a while, so are presumably not maintained or widely used.)

So by raw numbers, the ecosystem is less than 50% migrated. This isn't taking into account popularity though, so it's hard to translate that to real-world impact.

@tvolkert
Copy link
Contributor
tvolkert commented Apr 8, 2021

If we could get popularity, I'd be willing to jump on a few 3P PRs for popular packages that are on ^0.16.1 to help them migrate.

@stuartmorgan-g
Copy link
Contributor

I don't think that information is public, so we'd need to enlist pub.dev folks.

My guess though is that popular packages have already heard from users.

@jonasfj
Copy link
Member
jonasfj commented Apr 9, 2021

I don't think that information is public, so we'd need to enlist pub.dev folks.

The popularity metric as a score between 1 and 0 is public. The API isn't stable, so it may break at any time, example:

  • https://pub.dev/api/packages/retry/metrics (see popularityScore)

@Hixie
Copy link
Contributor
Hixie commented Apr 13, 2021

Any updates here?

@stuartmorgan-g
Copy link
Contributor
stuartmorgan-g commented Apr 14, 2021

Sorting by popularity, the top ten plugins that are using something older than 0.17 (number in parentheses is its place on the list of all intl dependencies sorted by popularity):

  • flutter_money_formatter (32): ^0.15.8—Apparently abandoned, and doesn't work with previous stable versions of Flutter either.
  • angular (33): ^0.16.0—Has a fix on master, but unpublished
  • dash_chat (36): ^0.16.0—Has a fix on master, but unpublished
  • angular_components (41) ^0.16.0
  • webfeed (45): ^0.16.0
  • bezier_chart (46): ^0.16.0
  • horizontal_calendar_widget (56): ^0.16.1
  • flutter_clean_calendar (63): ^0.16.1
  • commons (64): ^0.16.1
  • flutter_calendar (68): ^0.16.0

@kevmoo Can we just fix angular and angular_components?

(I'm skeptical about the utility of this sort, given that the one with the highest popularity score has been broken since well before Flutter 2.)

@kevmoo
Copy link
Contributor
kevmoo commented Apr 14, 2021 via email

@jakemac53
Copy link
Contributor

I don't think there is a reason to depend on both angular and flutter in the same project is there? If that assumption that is correct then these shouldn't be affected by flutter package dependencies.

@kevmoo
Copy link
Contributor
kevmoo commented Apr 14, 2021 via email

@pedromassangocode pedromassangocode added the has reproducible steps The issue has been confirmed reproducible and is ready to work on label Apr 15, 2021
@Hixie
Copy link
Contributor
Hixie commented Apr 20, 2021

What is actionable here at this point? I'm eager for us to make progress but it's not clear to me what progress actually looks like here.

@kevmoo
Copy link
Contributor
kevmoo commented Apr 20, 2021

I don't know how many apps are flutter + angular. We are getting a bit closer to releasing the latest angular, but it's not going to be soon.

Otherwise, it's a matter of going after these other big blockers and getting them to migrate – right?

@stuartmorgan-g
Copy link
Contributor

Otherwise, it's a matter of going after these other big blockers and getting them to migrate – right?

I think the issue is whether we know what the "big blockers" actually are. It seems very unlikely that an abandoned project to format money that didn't work in Flutter 1.20 either is actually a major blocker, but it's at the top of the popularity sort.

@jonasfj How much do we trust that the popularity score reflects real, current usage?

@jonasfj
Copy link
Member
jonasfj commented Apr 27, 2021

@stuartmorgan There are lots of caveats to our current popularity metrics.
As a relative number it's not entirely unfair, but it's biased in many unfortunate ways.
We also had a bug not long ago where pub would not send correct metadata about whether or not a dependency was direct or transitive.

On pub.dev we count transitive a weight of 0.1 and direct dependencies with a weight of 1, so getting that metadata wrong probably increased the popularity metric for a lot of packages like win32 and ffi which are frequently fetched as transitive dependencies.

If you look at things that depend on package:ffi, ordered by popularity you'll see:
https://pub.dev/packages?q=dependency%3Affi&sort=popularity
I'm guessing path_provider_windows which is used by path_provider, causes package:ffi and package:win32 to become very popular.
I think we've fixed the metadata, but that might not have reached the entirely population yet, I don't recall when/if it shipped.

The thing is that we only count requests going to pub.dev, and this depends a lot on client behavior.
For example, flutter pub get won't necessarily try to discover new versions for all dependencies, because it already has a version in pubspec.lock, so it's not attempted to upgrade.
And pub will rarely download package versions, because they are cached once in PUB_CACHE...
Add to this, the constant risk that we may not be successfully filtering out all CI platforms, and any one of those could skew our popularity metrics quite a bit.

Just saying: there are many ways in which these numbers aren't perfect.
I think they are reasonably good within an order of magnitude, there is a big difference between 100%, 99%, 90%, 10%, 1% popularity.

We are working to build better metrics in the future. If you have a specify package you're wondering about it might be worth looking at what depends on it.. maybe something there is popular. I can also go digging through a few logs to see what Dart / Flutter versions is using if that's interesting.

@stuartmorgan-g
Copy link
Contributor

I think the issue is whether we know what the "big blockers" actually are. It seems very unlikely that an abandoned project to format money that didn't work in Flutter 1.20 either is actually a major blocker, but it's at the top of the popularity sort.

Jonas helped me dig into the numbers on this a bit, and it looks like the correct interpretation is not that the sort is wrong, but that the high end of that sort just isn't actually that high; there are so many packages that being 94% doesn't actually mean there are all that many users.

And looking at the issue tracker for the project, many of the bugs are about the compat issue with intl 0.15—from before Flutter 2—and people have suggested to each other to override that dependency, so it's likely that the reason there's still usage is that a certain number of people were already overriding intl to use it. That makes the level of usage it has much more plausible.

So it seems like the take-away from the list we have is that we don't actually have big blockers. Instead we have a long tail, which means there's not much we can reasonably do here; the LSC seems like the only thing that would have appreciable impact, but as mentioned above I don't see this as a safe candidate for an LSC.

My suggestion is that we close this as unactionable, unfortunately. We may want to file an issue about trying to come up with a generic solution for the problem of pinning third-party dependencies in the framework though, as this has happened before (like the 0.15/0.16 mismatch in the package above) and will happen again, even though it won't be at the scale of the Flutter 2/NNBD impact unless a similar ecosystem-wide migration happens again. @Hixie, thoughts?

@Hixie
Copy link
Contributor
Hixie commented Apr 29, 2021

Seems reasonable. Let's keep an eye out for whether something needs to change though.

@stuartmorgan-g
Copy link
Contributor

Filed #81472 to consider whether we can reduce this kind of problem in the future.

@github-actions
Copy link
github-actions bot commented Aug 2, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 2, 2021
@flutter-triage-bot flutter-triage-bot bot added P0 Critical issues such as a build break or regression and removed P2 labels Jun 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: null-safety Support for Dart's null safety feature a: release Challenges faced when attempting to productionize an app c: regression It was better in the past than it is now customer: crowd Affects or could affect many people, though not necessarily a specific customer. found in release: 2.0 Found to occur in 2.0 has reproducible steps The issue has been confirmed reproducible and is ready to work on P0 Critical issues such as a build break or regression r: invalid Issue is closed as not valid team-ecosystem Owned by Ecosystem team
Projects
None yet
Development

No branches or pull requests

0