ConstantReader class abstract

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

boolValue bool
Constant as a bool value.
no setter
doubleValue double
Constant as a double value.
no setter
hashCode int
The hash code for this object.
no setterinherited
intValue int
Constant as a int value.
no setter
isBool bool
Whether this constant represents a bool value.
no setter
isDouble bool
Whether this constant represents a double value.
no setter
isInt bool
Whether this constant represents an int value.
no setter
isList bool
Whether this constant represents a List value.
no setter
isLiteral bool
Whether this constant is a literal value.
no setter
isMap bool
Whether this constant represents a Map value.
no setter
isNull bool
Whether this constant is a null value.
no setter
isSet bool
Whether this constant represents a Set value.
no setter
isString bool
Whether this constant represents a String value.
no setter
isSymbol bool
Whether this constant represents a Symbol value.
no setter
isType bool
Whether this constant represents a Type value.
no setter
listValue List<DartObject>
Constant as a List value.
no setter
literalValue Object?
Constant as a literal value.
no setter
mapValue Map<DartObject?, DartObject?>
Constant as a Map value.
no setter
objectValue → DartObject
Underlying object this instance is reading from.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
setValue Set<DartObject>
Constant as a Set value.
no setter
stringValue String
Constant as a String value.
no setter
symbolValue Symbol
Constant as a Symbol value.
no setter
typeValue → DartType
Constant as a DartType representing a Type value.
no setter

Methods

instanceOf(TypeChecker checker) bool
Whether the value this constant represents matches checker.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent 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
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited