Clean up Flutter build and .dart_tool

build.dart_toolnext topubspec.yaml

Quick answer

Yes, Flutter's build/ and .dart_tool/ folders are safe to delete. flutter clean removes both; flutter pub get and your next build recreate them.

Rebuild with flutter pub get

What is it?

build/ holds compiled output for every platform you've run (APKs, iOS and macOS builds, web bundles). .dart_tool/ holds package configuration and code-generation caches.

Why does it get so big?

  • Build output for Android, iOS, web and desktop side by side
  • Intermediate files from Gradle and Xcode builds
  • build_runner and code-generation caches

How to clean it from the command line

flutter clean && flutter pub get

Review what a command matches before you run anything with rm -rf. These deletions are permanent.

What not to delete

  • pubspec.yaml and pubspec.lock
  • The global pub cache (~/.pub-cache) unless you mean to clear it
  • ios/Podfile.lock

How Gigaflush handles Flutter / Dart

Gigaflush lists build and .dart_tool only when pubspec.yaml sits right beside it, shows each folder's size, preselects nothing, and re-checks the folder immediately before deleting it. Symlinks and parent-directory paths are refused.

FAQ

What does flutter clean delete?

It deletes the project's build/ and .dart_tool/ directories along with some platform ephemeral files, so the next build starts fresh.

Is it safe to delete .dart_tool?

Yes. flutter pub get (or dart pub get) recreates it.

Why is my Flutter project so big?

Mostly build/: compiled output for each platform you've targeted. The source itself is usually small.

Further reading