Skip to content

Commit 5e37b83

Browse files
Bail out when props are conditionally forwarded
1 parent 0aa15fd commit 5e37b83

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tools/analyzer_plugin/lib/src/util/prop_forwarding/forwarded_props.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@ ForwardedProps? computeForwardedProps(FluentComponentUsage usage) {
7676
final methodName = invocation.methodName.name;
7777
final arg = invocation.node.argumentList.arguments.firstOrNull;
7878

79-
// FIXME what should we do about the second condition arg for addProps?
79+
if (methodName == 'addProps' || methodName == 'modifyProps') {
80+
// If props are conditionally forwarded, don't count them.
81+
final hasConditionArg = invocation.node.argumentList.arguments.length > 1;
82+
if (hasConditionArg) continue;
83+
}
84+
8085
final isAddAllOrAddProps = methodName == 'addProps' || methodName == 'addAll';
8186

8287
// ..addProps(props)

0 commit comments

Comments
 (0)