source_gen library Null safety

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 generates part of files.
Revivable
Decoded "instructions" for re-creating a const DartObject at runtime.
SharedPartBuilder
A Builder which generates content intended for part of files.
TypeChecker
An abstraction around doing static type checking at compile/build time.

Constants

defaultFileHeader → const String
'// GENERATED CODE - DO NOT MODIFY BY HAND'

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.