positionToScreenPoint method

Future<ScreenCoordinate?> positionToScreenPoint(
  1. RaliPosition position
)

Converts a geographical position to a screen point

Implementation

Future<mapbox.ScreenCoordinate?> positionToScreenPoint(RaliPosition position) async {
  try {
    // Use the conversion method from RaliPosition to get a mapbox Point
    final mapboxPoint = position.toMapboxPoint();

    final screenPoint = await mapboxMap.pixelForCoordinate(mapboxPoint);
    return screenPoint;
  } catch (e) {
    print('Error converting position to screen point: $e');
    return null;
  }
}