source_gen library
Classes
- AnnotatedElement
- Result of finding an annotation on element through LibraryReader.
- ConstantReader
-
A wrapper for analyzer's
DartObject
with a predictable high-level API. - Generator
- A tool to generate Dart code based on a Dart library source.
-
GeneratorForAnnotation<
T> -
Extend this type to create a Generator that invokes
generateForAnnotatedElement for every top level element in the source file
annotated with
T
. - LibraryBuilder
-
A
Builder
which generates standalone Dart library files. - LibraryReader
-
A high-level wrapper API with common functionality for
LibraryElement
. - PartBuilder
-
A
Builder
which generatespart of
files. - Revivable
-
Decoded "instructions" for re-creating a const
DartObject
at runtime. -
A
Builder
which generates content intended forpart of
files. - TypeChecker
- An abstraction around doing static type checking at compile/build time.
Constants
- defaultFileHeader → const String
Functions
-
spanForElement(
Element element, [SourceFile? file]) → SourceSpan -
Returns a source span that spans the location where
element
is defined. -
typeNameOf(
DartType type) → String -
Returns a non-null name for the provided
type
.
Exceptions / Errors
- InvalidGenerationSourceError
- May be thrown by generators during Generator.generate.
- UnresolvedAnnotationException
- Exception thrown when TypeChecker fails to resolve a metadata annotation.