toJson method

dynamic toJson([
  1. bool addGeometry = true
])

Implementation

dynamic toJson([bool addGeometry = true]) {
  final Map<String, dynamic> json = <String, dynamic>{};

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

  addIfPresent('circleRadius', circleRadius);
  addIfPresent('circleColor', circleColor);
  addIfPresent('circleBlur', circleBlur);
  addIfPresent('circleOpacity', circleOpacity);
  addIfPresent('circleStrokeWidth', circleStrokeWidth);
  addIfPresent('circleStrokeColor', circleStrokeColor);
  addIfPresent('circleStrokeOpacity', circleStrokeOpacity);
  if (addGeometry) {
    addIfPresent('geometry', geometry?.toJson());
  }
  addIfPresent('draggable', draggable);
  return json;
}