diff --git a/lib/src/dart3_suggestors/null_safety_prep/fn_prop_null_aware_call_suggestor.dart b/lib/src/dart3_suggestors/null_safety_prep/fn_prop_null_aware_call_suggestor.dart index fa809a91..8c3e0a98 100644 --- a/lib/src/dart3_suggestors/null_safety_prep/fn_prop_null_aware_call_suggestor.dart +++ b/lib/src/dart3_suggestors/null_safety_prep/fn_prop_null_aware_call_suggestor.dart @@ -101,8 +101,12 @@ class FnPropNullAwareCallSuggestor extends RecursiveAstVisitor /// after the null condition is checked. ExpressionStatement? _getPropFunctionExpressionBeingCalledConditionally( BinaryExpression condition) { - // if (props.fn != null) { ... } if (condition.parent is IfStatement) { + // + // Handles conditions of the form: + // if (props.fn != null) { ... } + // + var propFunctionBeingNullChecked = _getPropFunctionBeingNullChecked(condition); @@ -121,9 +125,12 @@ class FnPropNullAwareCallSuggestor extends RecursiveAstVisitor propFunctionBeingNullChecked?.staticElement?.declaration; return matches; }) as ExpressionStatement?; - // props.fn != null && ... } else if (condition.parent is ExpressionStatement && condition.leftOperand is BinaryExpression) { + // + // Handles conditions of the form: + // props.fn != null && ... + // final propFunctionBeingNullChecked = _getPropFunctionBeingNullChecked( condition.leftOperand as BinaryExpression); if (propFunctionBeingNullChecked == null) return null;