Skip to content

Flutter downloads a toolchain per channel and keeps every build

The SDK, the pub cache and each project's build folder all grow separately. Which command clears which, and what a channel switch costs you.

5 min read

Flutter is generous with disk in three places at once, and clearing one of them does nothing for the other two. Knowing which is which turns a vague several gigabytes into three specific numbers.

The three places

du -sh ~/flutter ~/development/flutter ~/.pub-cache 2>/dev/null
flutter doctor -v | head -5
LocationWhat it isHow to shrink it
The SDK folderFramework, tools, and a cached engine per platformRemove unused platform artefacts
~/.pub-cacheEvery version of every package ever fetcheddart pub cache clean
build and .dart_tool in projectsCompiled output per projectflutter clean

The engine artefacts you are not using

The SDK downloads prebuilt engine binaries for each platform you target, and it keeps them for every platform it has ever been asked about. On a Mac that has built for iOS, Android, web and desktop, that is four sets.

du -sh ~/flutter/bin/cache/artifacts/* 2>/dev/null | sort -h
flutter precache --help

flutter precache with specific platform flags redownloads only what you need after clearing the cache folder, which is the supported way to end up with a smaller set rather than deleting artefacts by hand.

Channels are separate installations

Switching channel with flutter channel changes the checked out version in place, but the cached artefacts for the previous version stay behind, and a second SDK clone for a different channel is a second copy of everything. If you have two Flutter folders, that is not an accident to be tidied later, it is a duplicate to decide about now.

Project build folders are the recurring cost

find ~ -type d -name .dart_tool -maxdepth 6 2>/dev/null \
  -exec du -sh {} + | sort -h | tail -15

Each project's build and .dart_tool folders are regenerated by the next build, and flutter clean removes both. For projects you are not actively working on, this is free space with no downside beyond one slow build if you return.

On a machine that also builds native apps, this sits alongside Xcode's DerivedData and the Gradle folder, both of which are usually larger again.

Common questions

What does flutter clean actually delete?

The build and .dart_tool folders in the current project. Both are regenerated by the next build, so the only cost is compilation time. It does not touch the SDK or the pub cache.

How big is the Flutter pub cache?

It grows with every package version any project has ever used, since nothing removes old versions. dart pub cache clean empties it entirely, after which every project redownloads its dependencies on the next build.

Can I delete Flutter engine artefacts?

Yes, and flutter precache with platform flags redownloads only the ones you need. The SDK keeps prebuilt engines for every platform it has been asked about, which on a Mac targeting several platforms is a substantial share of the folder.

Does switching Flutter channels use more disk space?

Yes. Cached artefacts for the previous version remain, and keeping a second SDK clone for another channel duplicates the whole toolchain. Two Flutter folders on one Mac is a decision worth making explicitly.

Read next