/google_maps_webservice

Primary LanguageDartBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

google_maps_webservice

Build Status codecov Donate

Google Maps Web Services API

API key

To use this library you need a Web API key. Here

This is not compatible with Android and iOS API key but can be use inside a Flutter app.

Availables API

Usage

Geocoding

import "package:google_maps_webservice/geocoding.dart";

final geocoding = new GoogleMapsGeocoding(apiKey: "<API_KEY>");
final geocoding = new GoogleMapsGeocoding(apiKey: "<API_KEY>", httpClient: new BrowserClient());
final geocoding = new GoogleMapsGeocoding(baseUrl: "http://myProxy.com");

GeocodingResponse response = await geocoding.searchByAddress("1600 Amphitheatre Parkway, Mountain View, CA");

Places

import "package:google_maps_webservice/places.dart";

final places = new GoogleMapsPlaces(apiKey: "<API_KEY>");
final places = new GoogleMapsPlaces(apiKey: "<API_KEY>", httpClient: new BrowserClient());
final places = new GoogleMapsPlaces(baseUrl: "http://myProxy.com");

PlacesSearchResponse reponse = await places.searchNearbyWithRadius(new Location(31.0424, 42.421), 500);
PlacesSearchResponse reponse = await places.searchNearbyWithRankby(new Location(31.0424, 42.421), "distance");
PlacesSearchResponse reponse = await places.searchByText("123 Main Street");

PlacesDetailsResponse response = await places.getDetailsByPlaceId("PLACE_ID");
PlacesDetailsResponse response = await places.getDetailsByReference("REF");

Timezone

import "package:google_maps_webservice/timezone.dart";

final timezone = new GoogleMapsTimezone(apiKey: "<API_KEY>");
final timezone = new GoogleMapsTimezone(apiKey: "<API_KEY>", httpClient: new BrowserClient());
final timezone = new GoogleMapsTimezone(baseUrl: "http://myProxy.com");

TimezoneResponse response = await timezone.getByLocation(new Location(31.0424, 42.421));
TimezoneResponse response = await timezone.getByLocation(new Location(31.0424, 42.421), timestamp: DateTime.utc(2019, 4, 24));
TimezoneResponse response = await timezone.getByLocation(new Location(31.0424, 42.421), timestamp: DateTime.utc(2019, 4, 24), language: 'es');

Proxy

In case of using a proxy the baseUrl can be set. The apiKey is not required in case the proxy sets it. (Not storing the apiKey in the app is good practice)

Feature Requests and Issues

Please file feature requests and bugs at the issue tracker.