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', lineJoin);
addIfPresent('lineOpacity', lineOpacity);
addIfPresent('lineColor', lineColor);
addIfPresent('lineWidth', lineWidth);
addIfPresent('lineGapWidth', lineGapWidth);
addIfPresent('lineOffset', lineOffset);
addIfPresent('lineBlur', lineBlur);
addIfPresent('linePattern', linePattern);
if (addGeometry) {
addIfPresent('geometry',
geometry?.map((LatLng latLng) => latLng.toJson()).toList());
}
addIfPresent('draggable', draggable);
return json;
}