Description
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
.