AstHelper class

Constructors

AstHelper({FileParser parser = const FileParser()})
const

Properties

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

Methods

addElementToReturnListInFunction({required String source, required String functionName, required String elementSource, bool format = true}) → String
addExport({required String source, required String exportPath, bool format = true}) → String
addFieldToClass({required String source, required String className, required String fieldSource, bool format = true}) → String
addImport({required String source, required String importPath, bool format = true}) → String
addMethodToClass({required String source, required String className, required String methodSource, bool format = true}) → String
addMethodToExtension({required String source, required String extensionName, required String methodSource, bool format = true}) → String
addStatementToFunction({required String source, required String functionName, required String statementSource, bool format = true}) → String
extractExports(CompilationUnit unit) → List<String>
extractImports(CompilationUnit unit) → List<String>
findClass(CompilationUnit unit, String className) → ClassDeclaration?
findExtension(CompilationUnit unit, String extensionName) → ExtensionDeclaration?
findFields(ClassDeclaration classNode, {String? name}) → List<VariableDeclaration>
findFunction(CompilationUnit unit, String functionName) → FunctionDeclaration?
findMethods(ClassDeclaration classNode, {String? name}) → List<MethodDeclaration>
isClassEmpty(String source, String className) → bool
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parseFile(String path, {FileSystem? fileSystem}) → Future<AstParseResult>
parseSource(String source, {String path = 'input.dart'}) → AstParseResult
removeConstructorFromClass({required String source, required String className, bool format = true}) → String
removeElementFromReturnListInFunction({required String source, required String functionName, required String elementSource, bool format = true}) → String
removeElementsFromReturnListInFunctionWhere({required String source, required String functionName, required bool matches(String elementSource), bool format = true}) → String
removeFieldFromClass({required String source, required String className, required String fieldName, bool format = true}) → String
removeMethodFromClass({required String source, required String className, required String methodName, bool format = true}) → String
removeMethodFromExtension({required String source, required String extensionName, required String methodName, bool format = true}) → String
removeStatementFromFunction({required String source, required String functionName, required String statementSource, bool format = true}) → String
replaceConstructorInClass({required String source, required String className, required String constructorSource, bool format = true}) → String
replaceFieldInClass({required String source, required String className, required String fieldName, required String fieldSource, bool format = true}) → String
replaceMethodInClass({required String source, required String className, required String methodName, required String methodSource, bool format = true}) → String
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

areConstructorsEqual(ConstructorDeclaration a, ConstructorDeclaration b) → bool
Returns true if two constructor declarations are structurally equal (including parameters and initializers).
areConstructorSignaturesEqual(ConstructorDeclaration a, ConstructorDeclaration b) → bool
Returns true if two constructor declarations have equal signatures.
areFieldsEqual(VariableDeclaration a, VariableDeclaration b) → bool
Returns true if two variable declarations (fields) are equal (including type and name).
areMethodsEqual(MethodDeclaration a, MethodDeclaration b) → bool
Returns true if two method declarations are structurally equal (including return type, parameters, and body).
areSignaturesEqual(MethodDeclaration a, MethodDeclaration b) → bool
Returns true if two method declarations have equal signatures (return type, name, and parameters).