flutter clean, build/ and .dart_tool: what's safe to delete in a Flutter project

Which Flutter and Dart folders are generated, what flutter clean removes, and the other big Flutter caches: pub cache, Gradle, CocoaPods and Xcode.

Nov 1, 20262 min read

One plate per 100 MB of build output.dart_tool tray, filled by pub getAn example app's build/ directory, one bin per platform: 640 MB for Android, 900 MB for iOS, 140 MB for web and 420 MB for macOS, plus 128 MB of .dart_tool. flutter clean empties every bin and the tray; flutter pub get brings .dart_tool back.

Flutter projects are small until you run them. Build for Android, iOS, web and desktop and the project folder can grow by gigabytes. Almost all of it is regenerated on demand, which makes Flutter one of the most satisfying things to clean.

The two folders that matter

  • build/ is the output of every flutter run and flutter build: APKs and app bundles, iOS and macOS build products, web bundles, and intermediate files for each platform you’ve targeted. This is usually the big one.
  • .dart_tool/ holds Dart tooling state: the package configuration written by pub get, build_runner and code-generation caches, and other tool data. Smaller, but it’s regenerated by flutter pub get.

Both are safe to delete. Neither contains your code, assets or pubspec.lock.

What flutter clean does

flutter clean deletes build/ and .dart_tool/ for the current project (plus some platform-specific ephemeral files), so the next build starts from scratch. Afterwards, fetch packages again:

flutter clean
flutter pub get

Quick check: what’s safe?

Safe to delete? Tap to find out

The bigger Flutter caches outside your project

Project folders are only part of it. Flutter development also fills these shared locations. Clean them deliberately, knowing every project uses them:

  • Pub cache (~/.pub-cache on macOS and Linux, %LOCALAPPDATA%\Pub\Cache on Windows). Run dart pub cache clean to wipe it, and expect every project to download packages again.
  • Gradle (~/.gradle/caches), used by every Android build.
  • CocoaPods (~/Library/Caches/CocoaPods), cleared with pod cache clean --all.
  • Xcode DerivedData (~/Library/Developer/Xcode/DerivedData). See the Mac developer cleanup checklist.

The fast way for many projects

Running flutter clean in thirty folders is slow, because the Flutter tool has to start each time. Gigaflush finds build/ and .dart_tool/ in every Flutter project under a folder, shows sizes, and removes the ones you pick in one pass, alongside any node_modules, Rust target and other build output in the same scan.

Keep reading