updatePolygon method

Future<void> updatePolygon({
  1. required String polygonId,
  2. List<OlaLatLng>? points,
  3. String? color,
  4. String? borderColor,
  5. double? borderWidth,
  6. String? borderLineType,
})

Implementation

Future<void> updatePolygon({
  required String polygonId,
  List<OlaLatLng>? points,
  String? color,
  String? borderColor,
  double? borderWidth,
  String? borderLineType,
}) async {
  try {
    final args = <String, dynamic>{'polygonId': polygonId};
    if (points != null) {
      args['points'] = points.map((p) => p.toJson()).toList();
    }
    if (color != null) args['color'] = color;
    if (borderColor != null) args['borderColor'] = borderColor;
    if (borderWidth != null) args['borderWidth'] = borderWidth;
    if (borderLineType != null) args['borderLineType'] = borderLineType;
    await _invoke('updatePolygon', args);
  } catch (e) {
    debugPrint('Error updating polygon: $e');
  }
}