ASTScanner class

Scans a Dart project for all decorator annotations and produces ScanResults containing MethodAST + DecoratorAST pairs.

Two scan modes:

  • Resolved (default): full analyzer resolution through an AnalysisContextCollection. Slower; requires a valid package context (pubspec.yaml). Use when element-level information is needed.
  • Syntactic (resolve: false): parses each file with parseString — no analysis context, no pubspec requirement, an order of magnitude faster. Annotation metadata (names, arguments, locations) is purely syntactic, so decorator scanning is identical. This is the mode the route build stage uses (SC-002: <2s for ≤100 Views).

Constructors

ASTScanner({required String projectRoot, List<String> includeGlobs = const ['**/*.dart'], List<String> excludeGlobs = const ['**/*.g.dart', '**/*.freezed.dart'], bool resolve = true, RegExp? contentFilter})

Properties

contentFilter → RegExp?
Optional cheap pre-filter: files whose content does NOT match this pattern are skipped entirely (no parse, no resolve). Callers scanning for one decorator family (e.g. the route build stage) use this to stay inside tight time budgets on large projects.
final
excludeGlobs → List<String>
final
hashCode → int
The hash code for this object.
no setterinherited
includeGlobs → List<String>
final
projectRoot → String
final
resolve → bool
When false, files are parsed syntactically (parseString) instead of resolved through an analysis context — see class docs.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
scan() → Future<List<ScanResult>>
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited