getMapImageUri static method

Uri getMapImageUri(
  1. double latitude,
  2. double longitude
)

Constructs a URI for a static Google Maps image based on the provided latitude and longitude coordinates. The image will display a map centered at the specified coordinates with a red marker indicating the location.

@param latitude The latitude coordinate of the location. @param longitude The longitude coordinate of the location. @return A Uri representing the URI for the static Google Maps image.

Implementation

static Uri getMapImageUri(double latitude, double longitude) {
  var googleMapKey = Get.find<MainController>()
      .googleMapKey; // Obtain Google Maps API key from the main controller
  return Uri.parse(
      "https://maps.googleapis.com/maps/api/staticmap?center=$latitude,$longitude&zoom=13&size=300x200&markers=color:red|$latitude,$longitude&key=$googleMapKey");
}