toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final json = <String, dynamic>{};
  json['node'] = node;
  json['properties'] = properties.map((property) {
    final json = <String, dynamic>{};
    json['property'] = property.property.toString().split('.').last;
    if (property.property == NodeProperties.fill) {
      final fill = property.value as FFill;
      json['value'] = {
        'color': fill.levels.first.color,
        'opacity': fill.levels.first.opacity
      };
      return json;
    }
    json['value'] = property.value;
    return json;
  }).toList();
  return json;
}