Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why would I want to delete build/ directory?

Tags:

flutter

(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?

like image 230
Lord Null Avatar asked Jan 27 '23 01:01

Lord Null


1 Answers

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.

like image 182
Günter Zöchbauer Avatar answered Feb 08 '23 19:02

Günter Zöchbauer