toJson method

Map<String, dynamic> toJson()

Converts the DynamicColor object into a JSON map.

This method serializes the DynamicColor object into a format that can be sent or stored as JSON.

Implementation

Map<String, dynamic> toJson() {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['r'] = r;
  data['g'] = g;
  data['b'] = b;
  data['opacity'] = opacity;
  return data;
}