Skip to content

avoid_classes_with_only_static_members with static final members #59895

@mabdelaal86

Description

@mabdelaal86

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packagelinter-false-positiveIssues related to lint rules that report a problem when it isn't a problem.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions