updatePolyline method

Future<void> updatePolyline({
  1. required String polylineId,
  2. List<OlaLatLng>? points,
  3. String? color,
  4. double? width,
})

Update polyline points

Implementation

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