code_builder
library
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)
.