Reputation: 5166
As the image show, there are several versions of same pubs in my local:
.pub-cache/hosted/pub.dartlang.org/some-version1
. .pub-cache/hosted/pub.dartlang.org/some-version2
. .pub-cache/hosted/pub.dartlang.org/some-version3
. .pub-cache/hosted/pub.dartlang.org/some-version4
. Is there a way to clean them ?
Or clean them by provide a minimal dart version
. (like mini dart > 2.6.0
) ?
Upvotes: 4
Views: 5796
Reputation: 30164
Since Dart 2.14 there is:
flutter pub cache clean
Which will give you a prompt to chicken out:
This will remove everything inside /Users/jannie/.pub-cache. You will have to run
flutter pub get
again in each project. Are you sure? (y/N)?
For more info, see the docs.
Upvotes: 1
Reputation: 5166
flutter 1.17
provided a new commend: flutter pub outdated
. which have good progress on this.
Upvotes: 1
Reputation: 11984
I don't think there is a command for that. Because pub cannot know whether you have an old project lying around that depends on one of these older package versions or not.
The easiest way to clean away old packages is to just delete .pub-cache
altogether. When you first run flutter pub get
the ones that you actually use will be re-downloaded. This would get rid of the unused ones.
Upvotes: 4