check method
void
check(
- DcqRegistry registry
)
Implementation
@override
void check(
DcqRegistry registry,
) {
registry.addInstanceCreationExpression((node) {
if (node.constructorName.type.name.lexeme != 'Expanded') return;
final childArg = node.argumentList.arguments
.whereType<NamedExpression>()
.where((arg) => arg.name.label.name == 'child')
.firstOrNull;
if (childArg == null) return;
final childExpr = childArg.expression;
if (childExpr is! InstanceCreationExpression) return;
final childName = childExpr.constructorName.type.name.lexeme;
if (childName != 'SizedBox' && childName != 'Container') return;
final childArgs = childExpr.argumentList.arguments;
if (childArgs.isNotEmpty) return;
reportAtNode(node);
});
}