run method
void
run(
- CustomLintResolver resolver,
- DiagnosticReporter reporter,
- CustomLintContext context
Emits lints for a given file.
run will only be invoked with files respecting filesToAnalyze
Implementation
@override
void run(
CustomLintResolver resolver,
DiagnosticReporter reporter,
CustomLintContext context,
) {
context.registry.addInstanceCreationExpression((node) {
final targetType = node.staticType;
if (targetType == null ||
!containerTypeChecker.isExactlyType(targetType)) {
return;
}
final length = node.argumentList.arguments.length;
final hasChild = node.argumentList.argumentByName('child') != null;
if (length < 2 ||
(length == 2 && hasChild) ||
_canBeSizedBox(node) ||
_canBeTransform(node)) {
reporter.atNode(node, _code);
}
});
}