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
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
Youll be asked to confirm your decision:
AdvertisementsType Y to continue:
As of now, youll have to run flutter pub get in your projects to install the plugins you are using.
Thats it. Further reading:
- Using Font Awesome Icons in Flutter
- How to Get Device ID in Flutter (2 approaches)
- Flutter: ExpansionTile examples
- Flutter & Dart: Count Occurrences of each Element in a List
- How to implement a loading dialog in Flutter
- Using NavigationRail and BottomNavigationBar in Flutter
You can also check out our Flutter category page or Dart category page for the latest tutorials and examples.