toDict method

Map<String, dynamic> toDict()

Convert the object to a dictionary.

Implementation

Map<String, dynamic> toDict() {
  List<double>? tCoord;
  if (textureCoordinates != null) {
    tCoord = [];
    for (Offset o in textureCoordinates!) {
      tCoord.add(o.dx);
      tCoord.add(o.dy);
    }
  }
  Map<String, dynamic> d = {};
  d['class_name'] = className;
  d['version'] = version;
  d['bg'] = [bg.alpha, bg.red, bg.green, bg.blue];
  d['is_fill'] = isFill;
  d['stroke_width'] = strokeWidth;
  d['stroke_color'] = [
    strokeColor.alpha,
    strokeColor.red,
    strokeColor.green,
    strokeColor.blue
  ];
  d['image_index'] = imageIndex;
  d['texture_coordinates'] = tCoord;
  d['name'] = name;
  d['option'] = option;
  return d;
}