updateMarker method

Future<void> updateMarker({
  1. required String markerId,
  2. OlaLatLng? position,
  3. double? iconRotation,
})

Update an existing marker

Implementation

Future<void> updateMarker({
  required String markerId,
  OlaLatLng? position,
  double? iconRotation,
}) async {
  try {
    final args = <String, dynamic>{'markerId': markerId};
    if (position != null) {
      args['latitude'] = position.latitude;
      args['longitude'] = position.longitude;
    }
    if (iconRotation != null) {
      args['iconRotation'] = iconRotation;
    }
    await _channel.invokeMethod('updateMarker', args);
  } catch (e) {
    debugPrint('Error updating marker: $e');
  }
}