buildStaticMapUrl method

String buildStaticMapUrl(
  1. double lat,
  2. double lng
)

Builds a Google Static Maps URL for the given latitude and longitude.

The image includes a red marker and is rendered with zoom 13,

Implementation

String buildStaticMapUrl(double lat, double lng) {
  final apiKey = dotenv.env['API_KEY'];
  return 'https://maps.googleapis.com/maps/api/staticmap'
      '?center=$lat,$lng'
      '&zoom=13'
      '&size=300x120'
      '&scale=2'
      '&maptype=roadmap'
      '&markers=color:red%7Clabel:I%7C$lat,$lng'
      '&key=$apiKey';
}