Skip to content

Deprecate avoid_null_checks_in_equality_operators #59514

Open
@srawlins

Description

@srawlins

We introduced a new Warning called NON_NULLABLE_EQUALS_PARAMETER a few releases ago. It warns when the parameter of an operator == override has a nullable type:

"The parameter type of '==' operators should be non-nullable."

I didn't realize it at the time, but that new warning, plus null safety, basically replace the avoid_null_checks_in_equality_operators lint rule. This rule reports doing any null-check work on a nullable parameter of an operator == override.

As I found out when I migrated the tests from the legacy framework, the rule is a bit non-sensical now because of the redundancy. Every test case either has a WarningCode.NON_NULLABLE_EQUALS_PARAMETER, if it features a nullable parameter, or it features another warning like WarningCode.UNNECESSARY_NULL_COMPARISON_TRUE or StaticWarningCode.INVALID_NULL_AWARE_OPERATOR, if the parameter is non-nullable and is compared to null.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestarea-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-set-recommendedtype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions