requiredPatterns property
String patterns that must be present in the file for this rule to run.
Override to specify patterns for fast string-based early exit BEFORE AST parsing. If the file content doesn't contain ANY of these patterns, the rule is skipped entirely.
Example: A rule checking Timer.periodic usage:
@override
Set<String>? get requiredPatterns => {'Timer.periodic'};
Example: A rule checking various database calls:
@override
Set<String>? get requiredPatterns => {'rawQuery', 'rawInsert', 'execute'};
This is faster than AST traversal since it's a simple string search.
Return null to skip this optimization (default).
Implementation
@override
Set<String>? get requiredPatterns => const <String>{'auto_route'};