toJson method

Object toJson()

Converts this object to something serializable in JSON.

Implementation

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

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

  addIfPresent('poiId', poiId.value);
  addIfPresent('consumeTapEvents', consumeTapEvents);
  addIfPresent('position', position.toJson());
  addIfPresent('title', title);
  addIfPresent('titleColor', titleColor.value);
  // addIfPresent('subtitle', subtitle);
  addIfPresent('icon', icon.toJson());
  addIfPresent('type', type);
  addIfPresent('visible', visible);
  addIfPresent('zIndex', zIndex);

  return json;
}