toJson method
dynamic
toJson(
[ - bool addGeometry = true
])
Implementation
dynamic toJson([bool addGeometry = true]) {
final json = <String, dynamic>{};
void addIfPresent(String fieldName, dynamic value) {
if (value != null) {
json[fieldName] = value;
}
}
addIfPresent('lineJoin', polylineJoin);
addIfPresent('lineOpacity', polylineOpacity);
addIfPresent('lineColor', polylineColor.toHex());
addIfPresent('lineWidth', polylineWidth);
addIfPresent('lineGapWidth', polylineGapWidth);
addIfPresent('lineOffset', polylineOffset);
addIfPresent('lineBlur', polylineBlur);
addIfPresent('linePattern', polylinePattern);
if (addGeometry) {
addIfPresent('geometry',
geometry?.map((LatLng latLng) => latLng.toJson()).toList());
}
addIfPresent('draggable', draggable);
return json;
}