toJson method

  1. @override
Map<String, Object?> toJson(
  1. Map<Constant, int> constants
)
override

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]!)),
);