toJson method
Converts this object to something serializable in JSON.
Implementation
Object toJson() {
final Map<String, Object> json = <String, Object>{};
void addIfPresent(String fieldName, Object? value) {
if (value != null) {
json[fieldName] = value;
}
}
addIfPresent('colors',
colors.map((HeatmapGradientColor e) => e.color.value).toList());
addIfPresent('startPoints',
colors.map((HeatmapGradientColor e) => e.startPoint).toList());
addIfPresent('colorMapSize', colorMapSize);
return json;
}