Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to clean flutter outdated pubs

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) ?

enter image description here

like image 697
JerryZhou Avatar asked Sep 15 '25 20:09

JerryZhou


2 Answers

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.

like image 170
Gazihan Alankus Avatar answered Sep 17 '25 11:09

Gazihan Alankus


flutter 1.17 provided a new commend: flutter pub outdated. which have good progress on this.

like image 27
JerryZhou Avatar answered Sep 17 '25 09:09

JerryZhou