.pub-cache
What is .pub-cache?
In simple terms, .pub-cache is a hidden folder on your computer where Flutter (and Dart) stores all the packages and dependencies you've added to your project. When you use flutter pub get to fetch packages from pub.dev (the Dart and Flutter package repository), the downloaded packages are cached in this folder. It acts like a local storage locker, keeping everything you need for your app to run smoothly.
The location of the .pub-cache folder is typically:
- macOS and Linux: ~/.pub-cache
- Windows: C:\Users\<your_user>\AppData\Roaming\Pub\Cache
It's like the Flutter library's personal library of all the packages you've ever used!
Clear the Cache 🚿
If things get a little too messy, clearing out the .pub-cache folder can help. Run the following command to delete the cache:
flutter pub cache repair
This will remove the cache and re-download all your packages, which is helpful when you're dealing with strange package errors.
Check Cache Location 🔍
If you're curious about where exactly Flutter is storing the .pub-cache folder on your machine, you can use this command to check:
flutter pub cache
It'll show you the exact path, and you'll have a much better understanding of where all your cached packages are hanging out.