🧹 Flutter Clear (flutter_clear)

A powerful command-line tool designed to automatically scan directories for Flutter projects and execute flutter clean on each one, helping developers reclaim valuable disk space and maintain clean development environments.

πŸš€ The Problem

As a Flutter developer, you've likely experienced this frustrating scenario:

  • Low device storage warnings constantly interrupting your workflow
  • Multiple Flutter projects consuming gigabytes of disk space
  • Build directories growing to hundreds of megabytes or even several gigabytes per project
  • The tedious process of manually running flutter clean on each project individually

Flutter's build process generates significant intermediate files, compiled code, and platform-specific assets in directories like build/, .dart_tool/, and iOS/Android build folders. While these files are essential during development, they accumulate over time and can consume 20GB or more of storage across multiple projects.

In my case it consumed more than 64gb of space

πŸ’‘ The Solution

flutter_clear automates the cleanup process by:

βœ… Automatically scanning directories to identify Flutter projects (by detecting pubspec.yaml files)
βœ… Running flutter clean on each discovered project simultaneously
βœ… Shows totol projects found in the directory provided
βœ… Showing the cleaning progress during the cleanup operation
βœ… Supporting recursive directory scanning for nested project structures

alt text

πŸ“¦ Installation

Install Flutter Clear globally for system-wide access:

# Install from pub.flutter-io.cn
dart pub global activate flutter_clear

# Install from GitHub (latest development version)  
dart pub global activate -s git https://github.com/thisisprabhat/flutter_clear.git

Local Installation

For development or local usage:

# Clone the repository
git clone https://github.com/thisisprabhat/flutter_clear.git
cd flutter_clear

# Install dependencies  
dart pub get

# Activate locally
dart pub global activate --source path .

πŸ› οΈ Usage

Basic Usage

# Clean Flutter projects in current directory and all subdirectories just by running the following command
flutter_clear

πŸ”’ Safety Note: Only regeneratable files are removed. Your source code, assets, configuration files, and any custom modifications remain completely untouched.

πŸ“Š Comparison with Alternatives

Feature Flutter Clear Manual Process IDE Tools
Batch Processing βœ… All projects at once ❌ One by one ⚠️ Limited
Space Reporting βœ… Detailed analysis ❌ Manual calculation ❌ Not available
Safety Checks βœ… Dry run & confirmation ⚠️ Manual verification ⚠️ Variable
Cross-Platform βœ… All platforms ⚠️ OS-dependent commands ⚠️ IDE-specific
Automation Ready βœ… CI/CD compatible ❌ Requires scripting ❌ Manual only
Speed ⚑ Parallel processing 🐌 Sequential ⚑ Fast (single project)

Libraries

flutter_clear