toJson method

Map<String, dynamic> toJson()

Converts this style configuration into a serializable JSON object.

Example output:

{
  "opacity": 0.9,
  "filter": "grayscale(50%)",
  "fit": "cover",
  "title": "Company Logo",
  "decoding": "auto"
}

Implementation

Map<String, dynamic> toJson() {
  return {
    if (opacity != null) 'opacity': opacity,
    if (filter != null) 'filter': filter,
    'fit': fit.name,
    if (title != null) 'title': title,
    if (decoding != null) 'decoding': decoding?.name,
  };
}