getLatLngFromMapUnits static method

LatLng getLatLngFromMapUnits({
  1. required LatLng referencePoint,
  2. required double x,
  3. required double y,
})

Returns the LatLng of a point given its relative position(x,y) to a reference point in map units

Useful for calculating the bounding box of a view

Implementation

static LatLng getLatLngFromMapUnits({
  required LatLng referencePoint,
  required double x,
  required double y,
}) {
  final distanceInMeter = sqrt(pow(x, 2) + pow(y, 2));
  final bearing = radianToDeg(atan2(x, y));
  return const Vincenty().offset(referencePoint, distanceInMeter, bearing);
}