JerryZhou
JerryZhou

Reputation: 5166

how to clean flutter outdated pubs

As the image show, there are several versions of same pubs in my local:

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

Upvotes: 4

Views: 5796

Answers (3)

Jannie Theunissen
Jannie Theunissen

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

JerryZhou
JerryZhou

Reputation: 5166

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

Upvotes: 1

Gazihan Alankus
Gazihan Alankus

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

Related Questions