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.addNamedType((NamedType node) {
if (node.name.lexeme != 'DioError') return;
// Only flag DioError in files that use dio, so an unrelated user-defined
// DioError elsewhere is not mistaken for the removed package type.
if (!fileImportsPackage(node, PackageImports.dio)) return;
reporter.atNode(node);
});
}