analysis_plugin_test_helper library
Utilities to help write tests for the analyzer plugins.
Classes
- DartUnitResolver
-
A test utility that resolves Dart source strings into fully resolved
ResolvedUnitResultinstances, enabling access to resolved elements, constant values, and type information.
Functions
-
findAnnotation<
D extends CompilationUnitMember> (CompilationUnit unit, {required String annotationName}) → Annotation? -
Returns the first
Annotationwhose resolved type name matchesannotationNameon anyDdeclaration inunit, ornullif none is found. -
findConstructorDeclaration(
CompilationUnit unit, String? name) → ConstructorDeclaration? -
Returns the first
ConstructorDeclarationwhose name matchesnameinunit, ornullif none is found. Passnullfornameto find the default constructor. -
findFactoryConstructorDeclaration(
CompilationUnit unit, String? name) → ConstructorDeclaration? -
Returns the first factory
ConstructorDeclarationwhose name matchesnameinunit, ornullif none is found. Passnullfornameto find the default factory constructor. -
findImportDirective(
CompilationUnit unit) → ImportDirective? -
Returns the first
ImportDirective, ornullif none is found. -
findMethodDeclaration(
CompilationUnit unit, String name) → MethodDeclaration? -
Returns the first
MethodDeclarationwhose name matchesname, ornullif none is found. -
getAnnotation<
D extends CompilationUnitMember> (CompilationUnit unit, {required String annotationName}) → Annotation -
Returns the first
Annotationwhose resolved type name matchesannotationNameon anyDdeclaration inunit, failing the test if absent. -
getConstructorDeclaration(
CompilationUnit unit, String? name) → ConstructorDeclaration -
Returns the first
ConstructorDeclarationwhose name matchesnameinunit, failing the test if absent. Passnullfornameto find the default constructor. -
getFactoryConstructorDeclaration(
CompilationUnit unit, String? name) → ConstructorDeclaration -
Returns the first factory
ConstructorDeclarationwhose name matchesnameinunit, failing the test if absent. Passnullfornameto find the default factory constructor. -
getImportDirective(
CompilationUnit unit) → ImportDirective -
Returns the first
ImportDirective, failing the test if absent. -
getMethodDeclaration(
CompilationUnit unit, String name) → MethodDeclaration -
Returns the first
MethodDeclarationwhose name matchesname, failing the test if absent.