Skip to content

Flutter-specific pub cache causes issues #53833

@tvolkert

Description

@tvolkert

Our package archives pre-caches packages in $FLUTTER_ROOT/.pub-cache, whereas normal Pub behavior is to use $HOME/.pub-cache. This causes a number of issues:

  1. If a developer has multiple Flutter SDKs installed (e.g. master + stable), they end up with two duplicated caches, wasting disk space
  2. If a developer has both a Flutter and Dart SDK installed, again they have duplicated caches
  3. General confusion over where the pub cache is located
  4. It causes package versioning issues when switching between SDKs or SDK versions. Often causes hard-to-debug issues with pub global activate packages with commands available from $PATH

The existence of and support for $FLUTTER_ROOT/.pub-cache supports the "offline" Flutter tool usage (e.g. flutter create --offline) as well as lowering the number of "post-installation" downloads the user has to suffer. But given that we don't advertise the --offline flag very well, many users aren't gaining its benefit. This leaves us with all the pain of the solution and little of the gain.

Two things we could do to improve this:

  1. Make the Flutter tool relocate $FLUTTER_ROOT/.pub-cache to $HOME/.pub-cache when it detects its existence.
  2. Nudge users towards --offline if their command fails due to lack of connectivity.

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work lista: first hourThe first hour of using Flutterc: new featureNothing broken; request for a new capabilitycustomer: productdependency: dartDart team may need to help ustoolAffects the "flutter" command-line tool. See also t: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions