Flutter: How to Repair/Remove all Dependencies in .pub-cache

Updated: March 31, 2023 By: A Goodman Post a comment

If you are developing an app using Flutter and have encountered a problem related to one or more packages being broken in the system cache (in the ./pub-cache folder), you can reinstall all your cached dependencies by executing the command below:

flutter pub cache repair

Screenshot:

This process can take from a few tens of seconds to several tens of minutes, depending on the number of packages to download and your internet speed.

If you want to delete all cached packages to get more free disk space or solve some problems, run the following command:

flutter pub cache clean

You’ll be asked to confirm your decision:

Type “Y” to continue:

As of now, you’ll have to run flutter pub get in your next project to install the plugins you are using.

That’s it. Further reading:

You can also check out our Flutter category page or Dart category page for the latest tutorials and examples.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

Related Articles