toJson method

dynamic toJson()

Implementation

dynamic toJson() {
  final Map<String, dynamic> json = <String, dynamic>{};

  void addIfPresent(String fieldName, dynamic value) {
    if (value != null) {
      json[fieldName] = value;
    }
  }

  addIfPresent('iconSize', iconSize);
  addIfPresent('iconImage', iconImage);
  addIfPresent('iconRotate', iconRotate);
  addIfPresent('iconOffset', _offsetToJson(iconOffset));
  addIfPresent('iconAnchor', iconAnchor);
  addIfPresent('fontNames', fontNames);
  addIfPresent('textField', textField);
  addIfPresent('textSize', textSize);
  addIfPresent('textMaxWidth', textMaxWidth);
  addIfPresent('textLetterSpacing', textLetterSpacing);
  addIfPresent('textJustify', textJustify);
  addIfPresent('textAnchor', textAnchor);
  addIfPresent('textRotate', textRotate);
  addIfPresent('textTransform', textTransform);
  addIfPresent('textOffset', _offsetToJson(textOffset));
  addIfPresent('iconOpacity', iconOpacity);
  addIfPresent('iconColor', iconColor);
  addIfPresent('iconHaloColor', iconHaloColor);
  addIfPresent('iconHaloWidth', iconHaloWidth);
  addIfPresent('iconHaloBlur', iconHaloBlur);
  addIfPresent('textOpacity', textOpacity);
  addIfPresent('textColor', textColor);
  addIfPresent('textHaloColor', textHaloColor);
  addIfPresent('textHaloWidth', textHaloWidth);
  addIfPresent('textHaloBlur', textHaloBlur);
  addIfPresent('geometry', geometry?.toJson());
  addIfPresent('zIndex', zIndex);
  addIfPresent('draggable', draggable);
  addIfPresent('eLoc', eLoc);
  return json;
}