Constant class sealed

A constant value that can be recorded and serialized.

This supports basic constants such as bools or ints, as well as ListConstant, MapConstant or InstanceConstant for more complex structures.

This follows the AST constant concept from the Dart SDK.

Implementers

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson(Map<Constant, int> constants) Map<String, Object?>
Converts this Constant object to a JSON representation.
toString() String
A string representation of this object.
inherited
toValue() Object?
Converts this Constant to the value it represents.

Operators

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

Static Methods

fromJson(Map<String, Object?> value, List<Constant> constants) Constant
Creates a Constant object from its JSON representation.