offsetToLatLng method

LatLng? offsetToLatLng(
  1. Offset offset, [
  2. double? width,
  3. double? height
])

Convert offset to latlng position on the map.

Implementation

LatLng? offsetToLatLng(Offset offset, [double? width, double? height]) {
  width ??= size.width;
  height ??= size.height;

  UPoint point = offsetToPoint(offset);
  UPoint centerPoint = project(center);
  UPoint diffPoint = UPoint(
    (width / 2) - point.x,
    (height / 2) - point.y,
  );

  return unproject(centerPoint - diffPoint);
}