transformer_utils
library
Classes
-
NodeWithMeta<TNode extends AnnotatedNode, TMeta>
-
Utility class that allows for easy access to an annotated node's
instantiated annotation.
-
TransformedSourceFile
-
A utility that allows for modification of a
SourceFile
via a series of
replacements, insertions, and removals.
Functions
-
assetIdToPackageUri(AssetId id)
→ Uri
-
Converts
id
to a "package:" URI.
-
copyClassMember(ClassMember? member, String body)
→ String
-
Returns a copy of a class
member
declaration with body
as a new
implementation.
-
getDeclarationsAnnotatedBy(CompilationUnit unit, Type annotation)
→ Iterable<CompilationUnitMember>
-
Finds and returns all declarations within a compilation
unit
that are
annotated with the given annotation
class.
-
getSpan(SourceFile sourceFile, AstNode node, {bool skipCommentAndMetadata = true})
→ SourceSpan
-
-
getSpanForNode(SourceFile sourceFile, AstNode node, {bool skipCommentAndMetadata = true})
→ SourceSpan
-
Returns a
SourceSpan
spanning from the beginning to the end of the given
node
. The preceding comment and metadata will be excluded if
skipCommentAndMetadata
is true.
-
instantiateAnnotation(AnnotatedNode member, Type annotationType, {dynamic onUnsupportedArgument(Expression argument)?})
→ dynamic
-
Uses reflection to instantiate and returns the first annotation on
member
of type
annotationType
, or null if no matching annotations are found.
-
stringLiteral(String? content, {bool quote = true, bool useSingleQuote = true})
→ String
-
Returns
content
escaped and optionally quoted for use as a string literal
in Dart source code.