Open pvlKryu opened 1 month ago
@pq does this issue belong in dart-lang/linter?
Summary: The depend_on_referenced_packages
lint rule incorrectly flags imports in a multi-module Flutter project, even when dependencies are correctly specified in the module's pubspec.yaml
. The linter expects dependencies to be listed in the main pubspec.yaml
, which is not the expected behavior for multi-module projects.
@keertip might have some perspective?
any thoughts? @keertip @pq
@keertip: perhaps this is addressed w/ your recent fixes?
Assigning to Keerti for first thoughts.
Page URL
https://dart.dev/tools/linter-rules/depend_on_referenced_packages.html
Page source
https://github.com/dart-lang/site-www/tree/main/src/content/tools/linter-rules/individual-rules.md
Describe the problem
Title: Lint Rule
depend_on_referenced_packages
Triggers Incorrectly in Multi-Module Flutter ProjectDescription:
I am encountering an issue with the
depend_on_referenced_packages
lint rule in a multi-module Flutter project. The linter is flagging imports of packages as not being declared dependencies, despite them being correctly specified in the respective module'spubspec.yaml
file.Steps to Reproduce:
webview_flutter
andwebview_flutter_android
only in one of the module'spubspec.yaml
files.depend_on_referenced_packages
lint error.Example is on the screenshot 1.
Expected Behavior:
The linter should recognize the dependencies specified in the module's
pubspec.yaml
file and should not flag imports of these packages.Actual Behavior:
The linter flags the imports with the error:
However, when these dependencies are added to the main
pubspec.yaml
file, the lint warnings disappear.Screenshots:
Screenshot 1: Module's
pubspec.yaml
and imports causing lint error:Screenshot 2: Main
pubspec.yaml
resolving the lint error when dependencies are added:Additional Information:
I have tried clearing the cache, restarting the IDE, and running
flutter clean
followed byflutter pub get
, but the issue persists.Workaround:
Adding the dependencies to the main
pubspec.yaml
resolves the lint error, but this should not be necessary if the module'spubspec.yaml
is correctly configured.Request:
Please investigate this issue and provide guidance on how to correctly configure dependencies in a multi-module Flutter project without encountering this lint error.
Thank you!
Contact Information:
Expected fix
No response
Additional context
No response
I would like to fix this problem.