Flutter: Find Unused Dart Files (VSCode Extension)

Did you know?

Unused assets will increase your app bundle size, which is undesired.

To prevent this, you can install the "Find Unused Dart Files" extension for VSCode.

Then, simply run it from the command palette and review all the unused assets, files, and dependencies. 👌

Flutter: Find Unused Dart Files & Assets
Flutter: Find Unused Dart Files & Assets

You can download the extension here:

Removing unused code via static analysis

Note: the extension works by finding references to the asset file names in your Dart code, and as such, it can produce false positives. So it's always best to check that they're actually unused before removing them.

If you want to reliably remove unused code and Dart files, consider using a static analysis tool like DCM, which can detect and remove any unused code via dcm fix or from the IDE.

Happy coding!

Want More?

Invest in yourself with my high-quality Flutter courses.

Flutter In Production

Flutter In Production

Learn about flavors, environments, error monitoring, analytics, release management, CI/CD, and finally ship your Flutter apps to the stores. 🚀

Flutter Foundations Course

Flutter Foundations Course

Learn about State Management, App Architecture, Navigation, Testing, and much more by building a Flutter eCommerce app on iOS, Android, and web.

Flutter & Firebase Masterclass

Flutter & Firebase Masterclass

Learn about Firebase Auth, Cloud Firestore, Cloud Functions, Stripe payments, and much more by building a full-stack eCommerce app with Flutter & Firebase.

The Complete Dart Developer Guide

The Complete Dart Developer Guide

Learn Dart Programming in depth. Includes: basic to advanced topics, exercises, and projects. Last updated to Dart 2.15.

Flutter Animations Masterclass

Flutter Animations Masterclass

Master Flutter animations and build a completely custom habit tracking application.