SourceParser class

A parser that caches parsed Dart compilation units.

This class provides methods to parse Dart source code and cache the resulting AST structures for efficient reuse. It can parse both Asset objects and raw string content.

Constructors

SourceParser()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear() → void
Removes all cached compilation units.
get(String key) → CompilationUnit?
Retrieves a cached compilation unit for the given key.
invalidate(String key) → void
Removes a cached compilation unit for the given key.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parse(Asset src, {bool allowSyntaxErrors = false}) → CompilationUnit
Parses a Dart asset into a compilation unit, with caching.
parseContent(String content(), {required String key, bool throwIfDiagnostics = false}) → CompilationUnit
Parses Dart source content into a compilation unit, with caching.
toString() String
A string representation of this object.
inherited

Operators

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