compute method
Computes the changes for this producer using builder.
This method should not modify fixKind.
Implementation
@override
Future<void> compute(ChangeBuilder builder) async {
final widgetCreation = node.findInstanceCreationExpression;
if (widgetCreation == null || !widgetCreation.isComponentCreation) {
return;
}
if (widgetCreation.childrenArgument case final childrenArgument?) {
final childrenExpression = childrenArgument.expression;
if (childrenExpression is ListLiteral &&
childrenExpression.elements.isNotEmpty) {
await _removeChildren(
builder,
widgetCreation,
childrenExpression.elements,
);
}
} else if (widgetCreation.childArgument case final childArgument?) {
await _removeSingle(builder, widgetCreation, childArgument.expression);
} else if (widgetCreation.builderArgument case final builderArgument?) {
await _removeBuilder(builder, widgetCreation, builderArgument);
} else {
await _removeSingleWhenInList(builder, widgetCreation);
}
}