There is an intuitive way for it.
Install this package
dev_dependencies:
dependency_validator: ^x.x.x
Then run flutter pub run dependency_validator
It will show all the details about the packages installed.
Example: =>
These packages are pinned in pubspec.yaml:
- dependency_validator: null — This is a direct pin.
- permission_handler: null — This is a direct pin.
- swipe_to: null — This is a direct pin.
These packages are used in lib/ but are not dependencies:
- connectivity
- meta
- path
The following packages contain executables, they are assumed to be used:
- flutter_native_splash
These packages may be unused, or you may be using assets from these packages:
- cupertino_icons
- firebase_analytics
- http
- loading
- sign_in_with_apple