Skip to content

Stop pinning dependencies #158050

Closed
Closed

Description

@spydon

Use case

One of the biggest pain points for package authors (and probably app developers too) that have been brought up during the Dart & Flutter Package Ecosystem Summits is that Flutter has pinned versions of its dependencies.

Why do we not want pinned dependencies? Because it leads to a lot trickier dependency version resolution than it needs to be for the end user. I would say almost all Flutter developers have at some point ended up in dependency resolution hell, before they realize that some dependencies needs to be treated with special care.

Since all of the pinned dependencies are controlled by Google it should be fairly straight forward to set up a process so that they all have some tests towards Flutter before doing a new non-breaking release or doing deprecations.
The main ones are: intl, meta, collection path, vector_math and async.

The Flutter team’s rationale for using pinned versions is outlined in this document but I have been told that removing the dependency pinning is on the radar, so I just want to open this so that we can track it somewhere.

Proposal

Things that needs to be solved:

  • Flutter builds should be hermetic.
  • When dependencies bump their versions they should not be able to break Flutter.

For the first one I'm thinking that it could be solved with a lock file that isn't shipped with Flutter, but used for the builds.

For the second one my suggestion is that we introduce CI checks that needs to run before releasing a new version of the dependencies to make sure that they don't break anything in Flutter. Deprecations have to be taken into consideration here too, since they are not counted as breaking in semver.

Activity

  1. added
    customer: crowdAffects or could affect many people, though not necessarily a specific customer.
    team-infraOwned by Infrastructure team
    P2Important issues not at the top of the work list
    fyi-ecosystemFor the attention of Ecosystem team
    on Nov 2, 2024
  2. jakemac53 commented on Nov 5, 2024

    @jakemac53
    Contributor

    I am not sure if it has been proposed in a GitHub issue, but there is an additional layer to this which I think would give us the best of both worlds.

    The idea is to create a new package, flutter_pinned_deps or similar. It ships with the SDK (so it is an sdk: flutter dependency), and it has the versions of the deps from the lockfile, but pinned in the style that flutter pins deps today.

    Then, if you want to have a more stable build, with versions of deps that have been tested with your flutter SDK, all you do is depend on that package. If you want to loosen the constraints and accept some amount of breakage risk, you don't depend on it. This allows the user to choose which mode they want to live in, and the maintenance burden should be low (the package could be easily automated).

    In practice you might want a few of these, flutter_test_pinned_deps etc. But, if they are fully automated that is probably fine.

    Alternative implementation

    We could also flip this around a little bit, if the flutter repo migrated to use the "workspaces" feature from pub. Then, we would manually curate these packages and their pinned versions - and this would transitively enforce the versions in the other packages in the workspace.

    You don't have to check in the pubspec.lock files in this case - these packages would be doing the version enforcement.

    The workflow for upgrading packages would then just be changing the pinned versions in these packages, which would allow bumping them individually, which isn't something even the current workflow really allows.

  3. spydon commented on Nov 5, 2024

    @spydon
    ContributorAuthor

    We could also flip this around a little bit, if the flutter repo migrated to use the "workspaces" feature from pub. Then, we would manually curate these packages and their pinned versions - and this would transitively enforce the versions in the other packages in the workspace.

    That sounds like a great idea! Then it should be very easy to properly check that a change is not breaking anything in Flutter too.

  4. stuartmorgan-g commented on Nov 5, 2024

    @stuartmorgan-g
    Contributor

    I'm not sure if there's an issue tracking it, but the other approach that's been floated for this in vendoring all of our dependencies. That doesn't work for anything we want to use in public APIs though.

  5. jakemac53 commented on Nov 5, 2024

    @jakemac53
    Contributor

    Many of the pinned deps come from flutter_test which depends on (and re-exports) test_api, which also definitely leaks various things from its own public APIs. So, I don't think vendoring is really an option for flutter_test at least.

  6. 25 remaining items

  7. loic-sharma commented on Apr 17, 2026

    @loic-sharma
    Member

    @sigurdm Reopening as it appears #184821 broke the tree.

    Example failure: https://ci.chromium.org/ui/p/flutter/builders/prod/Windows%20tool_integration_tests_4_10/157/overview

    14:17 +15: test/integration.shard/dependencies_test.dart: All dependencies are locked to their lower bound
    14:17 +15 -1: test/integration.shard/dependencies_test.dart: All dependencies are locked to their lower bound [E]
      Dependency "characters" in "C:\b\s\w\ir\x\w\flutter\packages\flutter\pubspec.yaml" is not locked at its lower bound.
      
      package:matcher                                       fail
      test\integration.shard\dependencies_test.dart 185:11  main.<fn>
    
  8. kevmoo commented on Apr 17, 2026

    @kevmoo
    Contributor

    Er, not.

  9. reopened this on Apr 17, 2026
  10. github-actions commented on May 5, 2026

    @github-actions

    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.

  11. locked as resolved and limited conversation to collaborators on May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listcustomer: crowdAffects or could affect many people, though not necessarily a specific customer.team-infraOwned by Infrastructure teamtriaged-infraTriaged by Infrastructure team

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions