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,
) {
bool hasReported = false;
context.addMethodInvocation((MethodInvocation node) {
if (hasReported) return;
final Expression? target = node.target;
if (target != null && isExactTarget(target, _syncPatterns)) {
reporter.atNode(node);
hasReported = true;
}
});
}