toJson method

  1. @override
Map<String, dynamic> toJson()
override

Converts the options to a JSON representation that can be parsed by the MapsIndoors Platform SDKs.

Unset properties are omitted rather than sent as null, so that they keep inheriting the CMS style natively.

Implementation

@override
Map<String, dynamic> toJson() {
  final json = <String, dynamic>{
    "strokeColor": strokeColor?.toRGBString(),
    "strokeOpacity": strokeOpacity,
    "strokeWeight": strokeWeight,
    "strokeStyle": strokeStyle?.toJson(),
    "haloEnabled": haloEnabled,
    "haloColor": haloColor?.toRGBString(),
    "haloOpacity": haloOpacity,
    "haloWeight": haloWeight,
    "animationType": animationType?.toJson(),
    "animationSpeed": animationSpeed,
    "animationMinDuration": animationMinDuration,
    "animationRepeating": animationRepeating,
    "forceAnimation": forceAnimation,
    "animatedOverlayColor": animatedOverlayColor?.toRGBString(),
    "animatedOverlayOpacity": animatedOverlayOpacity,
    "animatedOverlayWeight": animatedOverlayWeight,
    "fitBounds": fitBounds,
    "fitBoundsMaxZoom": fitBoundsMaxZoom,
    "fitBoundsPadding": fitBoundsPadding == null
        ? null
        : {
            "top": fitBoundsPadding!.top,
            "left": fitBoundsPadding!.left,
            "bottom": fitBoundsPadding!.bottom,
            "right": fitBoundsPadding!.right,
          },
  };
  json.removeWhere((key, value) => value == null);
  return json;
}