code_builder library

Classes

Allocator
Collects references and automatically allocates prefixes and imports.
BinaryExpression
Represents two expressions (left and right) and an operator.
BinaryPattern
A binary logical pattern (|| or &&).
Block
Represents blocks of statements of Dart code.
BlockBuilder
BooleanCondition
A boolean expression condition.
Branch
A branch within a Conditional (if or else if).
BranchBuilder
CaseCondition
An if-case condition: object case pattern [when guard].
CaseExpression
A case within a SwitchExpression.
CaseExpressionBuilder
CaseStatement
A case within a SwitchStatement.
CaseStatementBuilder
CastPattern
A cast pattern pattern as type.
Catch
A catch or on clause in a Try statement.
CatchBuilder
Class
ClassBuilder
ClosureExpression
Code
Represents arbitrary Dart code (either expressions or statements).
CodeExpression
Represents a Code block as an Expression.
Condition
A condition in a Branch (if or else if).
Conditional
An if/else if/else conditional statement.
ConditionalBuilder
ConstantPattern
A constant pattern matching a constant expression.
Constructor
ConstructorBuilder
ControlEmitter
Knowledge of how to write valid Dart code from ControlVisitor.
ControlVisitor<T>
Knowledge of different types of control flow constructs in Dart.
DartEmitter
Directive
DirectiveBuilder
Enum
EnumBuilder
EnumValue
EnumValueBuilder
EqualsDart
Implementation detail of using the equalsDart matcher.
Expression
Represents a code block that wraps an Expression. Represents a Dart expression.
ExpressionEmitter
Knowledge of how to write valid Dart code from ExpressionVisitor.
ExpressionVisitor<T>
Knowledge of different types of expressions in Dart.
Extension
ExtensionBuilder
ExtensionType
ExtensionTypeBuilder
Field
FieldBuilder
ForInLoop
A for-in loop statement.
ForInLoopBuilder
ForLoop
A for loop statement.
ForLoopBuilder
FunctionType
FunctionTypeBuilder
InvokeExpression
Represents invoking target as a method with arguments.
Library
LibraryBuilder
ListPattern
A list pattern [p1, p2, ...rest].
LiteralExpression
Represents a literal value in Dart source code.
LiteralListExpression
LiteralMapExpression
LiteralRecordExpression
LiteralSetExpression
MapPattern
A map pattern {'key': pattern}.
MapPatternEntry
An entry in a MapPattern.
Method
MethodBuilder
Mixin
MixinBuilder
ObjectPattern
An object destructuring pattern SomeClass(p1, name: p2).
Parameter
ParameterBuilder
ParenthesizedExpression
An Expression wrapped with parenthesis.
ParenthesizedPattern
A parenthesized pattern (pattern).
Pattern
A Dart pattern for pattern matching and destructuring.
PatternEmitter
Knowledge of how to write valid Dart code from PatternVisitor.
PatternVisitor<T>
Knowledge of different types of patterns in Dart.
RecordPattern
A record destructuring pattern (p1, name: p2).
RecordType
RecordTypeBuilder
Reference
A reference to symbol, such as a class, or top-level method or field.
RelationalPattern
A relational pattern (==, !=, <, >, <=, >=).
RepresentationDeclaration
RepresentationDeclarationBuilder
ScopedCode
Represents a code block that may require scoping.
Spec
SpecVisitor<T>
StaticCode
Represents a simple, literal code block to be inserted as-is.
SwitchExpression
A switch expression.
SwitchExpressionBuilder
SwitchStatement
A switch statement.
SwitchStatementBuilder
ToCodeExpression
Try
A try statement with optional catch and finally blocks.
TryBuilder
TypeDef
TypeDefBuilder
TypeReference
TypeReferenceBuilder
UnaryPattern
A unary postfix pattern (? or !).
VariablePattern
A variable pattern binding name.
WhileLoop
A while or do-while loop statement.
WhileLoopBuilder
WildcardPattern
A wildcard pattern _.

Constants

literalFalse → const Expression
Represents the literal value false.
literalNull → const Expression
Represents the literal value null.
literalTrue → const Expression
Represents the literal value true.

Functions

declareConst(String variableName, {Reference? type}) → Expression
Declare a const variable named variableName.
declareFinal(String variableName, {Reference? type, bool late = false}) → Expression
Declare a final variable named variableName.
declareVar(String variableName, {Reference? type, bool late = false}) → Expression
Declare a variable named variableName.
equalsDart(String source, [DartEmitter? emitter]) → Matcher
Returns a matcher for Spec objects that emit code matching source.
lazyCode(Code generate()) → Code
Returns a generic Code that is lazily generated when visited.
lazySpec(Spec generate()) → Spec
Returns a generic Spec that is lazily generated when visited.
literal(Object? literal, {Expression onError(Object)?}) → Expression
Converts a runtime Dart literal value into an Expression.
literalBool(bool value) → Expression
Create a literal expression from a boolean value.
literalConstList(List<Object?> values, [Reference? type]) → LiteralListExpression
Creates a literal const list expression from values.
literalConstMap(Map<Object?, Object?> values, [Reference? keyType, Reference? valueType]) → LiteralMapExpression
Create a literal const map expression from values.
literalConstRecord(List<Object?> positionalFieldValues, Map<String, Object?> namedFieldValues) → LiteralRecordExpression
Create a literal const record expression from positionalFieldValues and namedFieldValues.
literalConstSet(Set<Object?> values, [Reference? type]) → LiteralSetExpression
Creates a literal const set expression from values.
literalList(Iterable<Object?> values, [Reference? type]) → LiteralListExpression
Creates a literal list expression from values.
literalMap(Map<Object?, Object?> values, [Reference? keyType, Reference? valueType]) → LiteralMapExpression
Create a literal map expression from values.
literalNullSafeSpread() → Expression
Create a literal ...? operator for use when creating a Map literal.
literalNum(num value) → Expression
Create a literal expression from a number value.
literalRecord(List<Object?> positionalFieldValues, Map<String, Object?> namedFieldValues) → LiteralRecordExpression
Create a literal record expression from positionalFieldValues and namedFieldValues.
literalSet(Iterable<Object?> values, [Reference? type]) → LiteralSetExpression
Creates a literal set expression from values.
literalSpread() → Expression
Create a literal ... operator for use when creating a Map literal.
literalString(String value, {bool raw = false}) → Expression
Create a literal expression from a string value.
refer(String symbol, [String? url]) → Reference
Short-hand for Reference(symbol, url).