latLngToScreenPoint method

Point<double> latLngToScreenPoint(
  1. LatLng latLng
)

This will convert a latLng to a position that we could use with a widget outside of FlutterMap layer space. Eg using a Positioned Widget.

Implementation

Point<double> latLngToScreenPoint(LatLng latLng) {
  final nonRotatedPixelOrigin =
      (project(center, zoom) - nonRotatedSize / 2.0).round();

  var point = crs.latLngToPoint(latLng, zoom);

  final mapCenter = crs.latLngToPoint(center, zoom);

  if (rotation != 0.0) {
    point = rotatePoint(mapCenter, point, counterRotation: false);
  }

  return point.subtract(nonRotatedPixelOrigin);
}