guide
flutter clean for every project: build, .dart_tool and Pods
Quick answer
In one project: flutter clean (it deletes build/ and .dart_tool/). For every Flutter project under a folder:
find ~/Projects -name pubspec.yaml -not -path "*/.*" -execdir flutter clean \;flutter clean doesn't remove ios/Pods, macos/Pods or android/.gradle; those are safe to delete by hand.What flutter clean removes
Flutter's own help: "Delete the build/ and .dart_tool/ directories." On the Mac Sweep was built on, those two were the bulk of Flutter's footprint: Flutter build folders 18.8 GB across 37 projects and .dart_tool 8.6 GB across 52.
Run it everywhere
find ~/Projects -name pubspec.yaml -not -path "*/.*" -execdir flutter clean \;
-execdir runs flutter clean inside each folder that has a pubspec.yaml. Packages inside your projects (a packages/ folder, an example/ app) get cleaned too, which is fine. This needs Flutter on your PATH and is slow: it starts Flutter once per project.
What flutter clean leaves behind
| Folder | Safe? | Comes back with |
|---|---|---|
ios/Pods, macos/Pods | Yes | the next flutter run (or pod install in that folder) |
android/.gradle | Yes | the next Gradle run |
android/app/build, android/build | Yes, unless your repo commits them | the next Android build |
ios/build | Yes | the next iOS build |
On our Mac, 9 Flutter projects had android/build committed to git. Check before deleting: git ls-files android/build | head.
Bring a project back
flutter pub get
flutter run
The first build after a clean takes longer: Gradle and Xcode rebuild everything.
The shared Pub cache
Every Flutter project shares ~/.pub-cache (2.2 GB on our Mac). flutter pub cache clean clears it; the next flutter pub get downloads what each project needs.
Questions
What does flutter clean delete?
The project's build/ and .dart_tool/ folders, according to Flutter's own help text.
Does flutter clean delete ios/Pods?
No. Pods stay until you delete them or run pod deintegrate. They come back with the next flutter run or pod install.
Is .dart_tool safe to delete?
Yes. flutter pub get recreates it from pubspec.lock.
How do I clear the Flutter package cache?
flutter pub cache clean empties ~/.pub-cache, shared by all projects.