getLatLng method

  1. @override
Future<LatLng> getLatLng(
  1. ScreenCoordinate screenCoordinate, {
  2. required int mapId,
})
override

Returns LatLng corresponding to the ScreenCoordinate in the current map view.

A projection is used to translate between on screen location and geographic coordinates. Screen location is in screen pixels (not display pixels) with respect to the top left corner of the map, not necessarily of the whole screen.

Implementation

@override
Future<LatLng> getLatLng(
  ScreenCoordinate screenCoordinate, {
  required int mapId,
}) async {
  final List<dynamic> latLng = (await channel(mapId)
      .invokeMethod<List<dynamic>>(
          'map#getLatLng', screenCoordinate.toJson()))!;
  return LatLng(latLng[0] as double, latLng[1] as double);
}