You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Flutter's local .pub-cache doesn't interact well with separate Dart install #37481
When a developer has separate installs of the Flutter and Dart SDKs, our tools are confused by Flutter's separate .pub-cache. This can lead to inscrutable errors. E.g.,:
Just to explain why why we have the cache:
The pre-populated cache serves several purposes:
People can just run flutter run and it will work right out of the box, with no extra downloading.
People who download flutter when they have a fast connection, but try to use it the first time without a connection, or with a slow one, aren't disappointed (the airport problem), and
People in other parts of the world without access to the pub server (i.e. China) can download our package and use it instead of being stopped by not being able to access the server.
Ideally, we'd do some magic behind the scenes to merge that cache with the user's cache on first run or something. Even more ideally, we'd have a "real" installer, and be able to just install stuff into the user's cache in the first place.
Another option would be to have pub look in multiple caches (via some sort of PUB_CACHE_PATH var or something), and then we could set it in the flutter tool to look in the user's cache first and the pre-populated one second.
Via the PUB_CACHE environment variable, and defaults to ~/.pub-cache. We set PUB_CACHE inside of the flutter tool if we notice that the flutter directory has a .pub-cache.
The workaround for this issue is to have people delete the flutter directory's .pub-cache and just use theirs.
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.
Activity
gspencergoog commentedon Aug 2, 2019
Just to explain why why we have the cache:
The pre-populated cache serves several purposes:
flutter runand it will work right out of the box, with no extra downloading.Ideally, we'd do some magic behind the scenes to merge that cache with the user's cache on first run or something. Even more ideally, we'd have a "real" installer, and be able to just install stuff into the user's cache in the first place.
Another option would be to have
publook in multiple caches (via some sort ofPUB_CACHE_PATHvar or something), and then we could set it in the flutter tool to look in the user's cache first and the pre-populated one second.Hixie commentedon Aug 2, 2019
How does pub determine which cache to use?
gspencergoog commentedon Aug 2, 2019
Via the
PUB_CACHEenvironment variable, and defaults to~/.pub-cache. We setPUB_CACHEinside of the flutter tool if we notice that the flutter directory has a.pub-cache.The workaround for this issue is to have people delete the flutter directory's
.pub-cacheand just use theirs.github-actions commentedon Mar 27, 2023
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 -vand a minimal reproduction of the issue.