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) {
if (!_isSvgPictureNode(node)) return;
if (node.constructorName.name?.name != 'network') return;
if (_hasNamedArg(node, 'placeholderBuilder')) return;
// Skip intentionally invisible widgets (width: 0, height: 0).
final width = _literalDouble(node, 'width');
final height = _literalDouble(node, 'height');
if (width == 0.0 && height == 0.0) return;
reporter.atNode(node);
});
}