toJson method
Converts this Constant object to a JSON representation.
constants
needs to be passed, as the Constants are normalized and
stored separately in the JSON.
Implementation
@override
Map<String, Object?> toJson(Map<Constant, int> constants) => _toJson(
_type,
value.map((key, constant) => MapEntry(key, constants[constant]!)),
);