Lord Null
Lord Null

Reputation: 956

Why would I want to delete build/ directory?

(New to Flutter/Dart/Android)

In console just did:

C:\Users\lordnull>flutter help clean
Delete the build/ directory.

Just wondering why we would want to delete a project's build directory (using "flutter clean")? Does it help cure some transient Flutter problem? If so what?

Upvotes: 11

Views: 11631

Answers (1)

Günter Zöchbauer
Günter Zöchbauer

Reputation: 657929

The content of the build directory is updated incrementally depending on configuration or source changes for performance reasons because a full rebuild every time would take way too much time.

The dependencies can be quite complex and some changes don't invalidate all parts in build/ that need to be rebuilt after such changes.

This can lead to a corrupt build output.

flutter clean purges the build output and the next build action will rebuild everything from scratch.

That's not unique to Flutter. Most build systems offer such a clean step to ensure a build is not influenced by artifacts from previous build actions.

Upvotes: 19

Related Questions