Very strange message when analyzing the source code.
int? x;
if (x == null) {
//
}
The operand can't be null, so the condition is always 'true'.
Remove the condition.dartunnecessary_null_comparison
Yes, the condition is always 'true'.
But the operand can't be anything other than a null
.
The operand can't be null
is not true
.
Or am I somehow perceiving this incorrectly?
Very strange message when analyzing the source code.
int? x;
if (x == null) {
//
}
The operand can't be null, so the condition is always 'true'.
Remove the condition.dartunnecessary_null_comparison
Yes, the condition is always 'true'.
But the operand can't be anything other than a null
.
The operand can't be null
is not true
.
Or am I somehow perceiving this incorrectly?
Share Improve this question asked Feb 7 at 7:29 mezonimezoni 11.2k4 gold badges37 silver badges57 bronze badges 1 |1 Answer
Reset to default 2This is a known issue with the error message, that hasn't been fixed. It should say something like "is always null" instead of "can't be null" for this kind of case.
The operand must be 'null', so the condition is always 'true'
. – Dan R Commented Feb 7 at 11:36