updatePolygon method

Future<void> updatePolygon({
  1. required String polygonId,
  2. List<OlaLatLng>? points,
  3. String? color,
})

Update polygon properties

Implementation

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