runWithReporter method
Override this method to implement your lint rule.
Use context to register callbacks for AST node types:
context.addMethodInvocation((node) {
if (condition) {
reporter.atNode(node);
}
});
Implementation
@override
void runWithReporter(
SaropaDiagnosticReporter reporter,
SaropaContext context,
) {
context.addInstanceCreationExpression((InstanceCreationExpression node) {
final String? constructorName = node.constructorName.type.element?.name;
// Check TextStyle constructor
if (constructorName != 'TextStyle') return;
_checkFontSize(node.argumentList.arguments, reporter);
});
}