1

I have imported different packages during the development process to pubspec.yaml's dependencies section. Currently I am not using some of them, but not sure which ones. Is there an easy way to check if a package is used in any of the files?

Should I check all of the files for all packages?

yavuzyal
  • 13
  • 4
  • 1
    1. delete a dependency, run `flutter pub get` if there are no errors, it is not in use or 2. search in the whole project directory for occurences of the package name, if they only appear in the pubspec.yaml or at least not in any dart files it is probably not used. – MindStudio May 09 '23 at 12:07

1 Answers1

0

You can use https://pub.dev/packages/dependency_validator lib Add in pubspec.yml

dev_dependencies:
  dependency_validator: ^3.0.0

Run in terminal

dart pub run dependency_validator
redDwarf
  • 336
  • 1
  • 9