flutter_trim 1.1.0
flutter_trim: ^1.1.0 copied to clipboard
Interactive CLI that finds unused assets, Dart files, classes, functions and methods in Flutter projects and lets you keep or delete each one safely.
Changelog #
1.1.0 #
- Undo deletions. Every deleted file and removed declaration is backed
up in
.flutter_trim/backups/first. - New Undo last delete choice in the interactive review.
- New
--restoreflag: brings back everything deleted in the most recent session. - New
--[no-]backupflag (default on). The "not under git" confirmation is now only shown when backups are off. - New API:
BackupStore,BackupEntry,backupDirName,FileCleaner(backup:),CleanResult.backupId,PromptDecision.undo,TrimStats.restored/backedUp.
1.0.0 #
First release under the name flutter_trim. It continues
flutter_sweeper 1.0.0, which is
now discontinued.
Accuracy on large projects #
- Import URIs are percent-decoded, so folders with spaces
(
package:app/common%20widget/x.dart) are followed. Previously every file in such a folder was reported as unused. - Imports whose letter case differs from the file on disk
(
gatewayController.dartforgateWayController.dart) are resolved, as they are on macOS and Windows. Previously such files, and everything only they imported, were reported as unused. - Source files with invalid UTF-8 are read leniently instead of being skipped, so their references are never lost. Unreadable files now produce a visible warning.
- Verified on three production apps (400–600 Dart files each): 0 false positives across 134 findings.
New interface #
- Banner, run settings, a summary table and per-category tables that adapt to the terminal width and keep file names visible.
- Each finding is shown as a card with a code preview, a progress bar and running counts.
- Session summary with suggested next steps.
New options #
--jsonprints a machine-readable report.--fail-on-findingsexits with code 1 when anything unused is found.
Renamed #
- Executables
ftrim/flutter_trim(werefsweep/flutter_sweeper). - Config file
flutter_trim.yaml; markers// flutter_trim:keepand// flutter_trim:ignore_file. - Library
package:flutter_trim/flutter_trim.dart;SweepItemis nowTrimItem,SweeperConfigisTrimConfig,SweeperCommandRunnerisTrimCommandRunner,SweeperExceptionisTrimException,SweepReporter/SweepStatsareTrimReporter/TrimStats.
Carried over from flutter_sweeper 1.0.0 #
- Unused asset, unreferenced Dart file and unused declaration detection.
- Safe declaration removal that refuses edits adding syntax errors.
- Works with
package:analyzer6.x through 14.x (Dart 3.0 to the latest SDK).