ConstantReader class

A wrapper for analyzer's DartObject with a predictable high-level API.

Unlike DartObject.getField, the read method attempts to access super classes for the field value if not found.

Constructors

ConstantReader(DartObject object)
factory

Properties

anyValue Object
Constant as a literal value. [...]
@Deprecated('Use `literalValue`, will be removed in 0.8.0'), read-only
boolValue bool
Constant as a bool value.
read-only
doubleValue double
Constant as a double value.
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
intValue int
Constant as a int value.
read-only
isAny bool
Whether this constant is a literal value.
@Deprecated('Use `isLiteral`, will be removed in 0.8.0'), read-only
isBool bool
Whether this constant represents a bool value.
read-only
isDouble bool
Whether this constant represents a double value.
read-only
isInt bool
Whether this constant represents an int value.
read-only
isList bool
Whether this constant represents a List value.
read-only
isLiteral bool
Whether this constant is a literal value.
read-only
isMap bool
Whether this constant represents a Map value.
read-only
isNull bool
Whether this constant is a null value.
read-only
isString bool
Whether this constant represents a String value.
read-only
isSymbol bool
Whether this constant represents a Symbol value.
read-only
isType bool
Whether this constant represents a Type value.
read-only
listValue List<DartObject>
Constant as a List value.
read-only
literalValue Object
Constant as a literal value. [...]
read-only
mapValue Map<DartObject, DartObject>
Constant as a Map value.
read-only
objectValue DartObject
Underlying object this instance is reading from.
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
stringValue String
Constant as a String value.
read-only
symbolValue Symbol
Constant as a Symbol value.
read-only
typeValue DartType
Constant as a DartType representing a Type value.
read-only

Methods

instanceOf(TypeChecker checker) bool
Whether the value this constant represents matches checker.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
peek(String field) ConstantReader
Reads field from the constant as another constant value. [...]
read(String field) ConstantReader
Reads field from the constant as another constant value. [...]
revive() Revivable
Returns as a revived meta class. [...]
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited