Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prefer_foreach message and suggested fix is unclear #56995

Open
LouiseHsu opened this issue Oct 30, 2024 · 0 comments
Open

prefer_foreach message and suggested fix is unclear #56995

LouiseHsu opened this issue Oct 30, 2024 · 0 comments
Labels
analyzer-quick-fix area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. type-enhancement A request for a change that isn't a bug

Comments

@LouiseHsu
Copy link

Describe the issue

The lint asks me to use a forEach instead of a for loop for passing in function literals, but once it converts it to a for loop I get a new warning tell me to use forEach for applying functions. From discussion with the analyzer team, it seems like the second lint wants me to convert it to using a foreach with a tear-off, but no fix is offered.

To Reproduce
https://github.com/user-attachments/assets/df5b40c3-5e19-4675-a704-38d35d6f52a9

Expected behavior
Either the fix for the lint should have changed it to an acceptable state, or the message should have been more clear.

@bwilkerson bwilkerson transferred this issue from dart-lang/linter Oct 30, 2024
@bwilkerson bwilkerson added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-quick-fix type-enhancement A request for a change that isn't a bug labels Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-quick-fix area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

2 participants