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

avoid_classes_with_only_static_members with static final members #59895

Open
mabdelaal86 opened this issue Jan 13, 2025 · 0 comments
Open

avoid_classes_with_only_static_members with static final members #59895

mabdelaal86 opened this issue Jan 13, 2025 · 0 comments
Labels
analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. linter-false-positive P2 A bug or feature request we're likely to work on

Comments

@mabdelaal86
Copy link
Contributor

According to "Effective Dart: Design", it is encouraged to avoid defining a class that contains only static members, but this isn't a hard rule. For example, with constants and enum-like types, it may be natural to group them in a class.

I have an issue with static final members. I believe they should be considered as constants and it should be allowed to group static constant and final members in classes.
There are some types that don't have a constant constructor, so the only way to create constant values of such types is by using final keyword.
But the analyzer complains about such classes as they have a static final member.

@mabdelaal86 mabdelaal86 added the area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. label Jan 13, 2025
@scheglov scheglov added analyzer-linter Issues with the analyzer's support for the linter package P2 A bug or feature request we're likely to work on linter-false-positive labels Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. linter-false-positive P2 A bug or feature request we're likely to work on
Projects
None yet
Development

No branches or pull requests

2 participants