Index: pkg/analyzer/lib/src/generated/resolver.dart |
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart |
index b5d6e1dff9f4204d4916ee9166274bd60a6c6528..2d5fac3269d04c5bcd01af8a8d70c3c9d7b6a13e 100644 |
--- a/pkg/analyzer/lib/src/generated/resolver.dart |
+++ b/pkg/analyzer/lib/src/generated/resolver.dart |
@@ -665,6 +665,8 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> { |
} |
if (condition is BinaryExpression) { |
_checkForPossibleNullConditionInBinaryExpression(condition); |
+ } else if (condition is PrefixExpression) { |
+ _checkForPossibleNullConditionInPrefixExpression(condition); |
} else { |
_checkForPossibleNullConditionInSimpleExpression(condition); |
} |
@@ -686,6 +688,17 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> { |
} |
/** |
+ * Produce a hint if the operand of the given prefix [condition] could |
+ * have a value of `null`. |
+ */ |
+ void _checkForPossibleNullConditionInPrefixExpression( |
+ PrefixExpression condition) { |
+ if (condition.operator?.type == TokenType.BANG) { |
+ _checkForPossibleNullCondition(condition.operand); |
+ } |
+ } |
+ |
+ /** |
* Produce a hint if the given [condition] could have a value of `null`. |
*/ |
void _checkForPossibleNullConditionInSimpleExpression(Expression condition) { |