addMarker method

Future<String?> addMarker({
  1. required OlaLatLng position,
  2. String? markerId,
  3. bool isClickable = true,
  4. double iconRotation = 0.0,
  5. bool isAnimationEnabled = true,
  6. String? snippet,
  7. String? subSnippet,
  8. bool isInfoWindowDismissOnClick = true,
})

Add a marker to the map

Implementation

Future<String?> addMarker({
  required OlaLatLng position,
  String? markerId,
  bool isClickable = true,
  double iconRotation = 0.0,
  bool isAnimationEnabled = true,
  String? snippet,
  String? subSnippet,
  bool isInfoWindowDismissOnClick = true,
}) async {
  try {
    final result = await _channel.invokeMethod('addMarker', {
      'markerId': markerId ?? DateTime.now().millisecondsSinceEpoch.toString(),
      'latitude': position.latitude,
      'longitude': position.longitude,
      'isClickable': isClickable,
      'iconRotation': iconRotation,
      'isAnimationEnabled': isAnimationEnabled,
      'snippet': snippet,
      'subSnippet': subSnippet,
      'isInfoWindowDismissOnClick': isInfoWindowDismissOnClick,
    });
    return result as String?;
  } catch (e) {
    debugPrint('Error adding marker: $e');
    return null;
  }
}