0 purchases
google maps api flutter
Flutter Google Maps API Package #
This package seamlessly integrates the Google Maps API into your Flutter application, offering type-safe requests and responses, complemented with versatile widgets.
Features #
API #
The package provides fully type-safe request and response handling for the following Google Maps API endpoints:
Places API:
Autocomplete
Details
Search (Upcoming)
Photos (Upcoming)
Geocoding:
Geocode (Upcoming)
Reverse Geocoding (Upcoming)
Routes:
Various functionalities (Upcoming)
Widgets #
In addition to API integration, this package offers customizable widgets leveraging these APIs, such as:
Place Autocomplete Widget
Getting Started #
Obtain an API key from Google Cloud Console.
Ensure the key is enabled for WEB Requests since the package uses HTTP requests to interact with the APIs.
Install the latest version of this package using:
flutter pub add google_maps_api
copied to clipboard
Usage #
Initialize the API with your key:
final googleMapsApi = GoogleMapsApi(apiKey: "YOUR_API_KEY");
copied to clipboard
Example usage for retrieving place details:
final googleMapsApi = GoogleMapsApi(apiKey: "YOUR_API_KEY");
PlacesDetailsResponse response = await googleMapsApi.places.details(
placeId: "ChIJN1t_tDeuEmsRUsoyG83frY4",
);
if (response.status == PlacesDetailsStatus.OK) {
print(response.place);
}
copied to clipboard
Widget example:
PlaceAutocomplete(
onSelected: (selection) {
setState(() {
_selection = selection;
});
},
apiKey: "YOUR_API_KEY",
),
copied to clipboard
For more examples, refer to the /example directory, which includes a comprehensive sample application.
Additional Information #
Contributing #
As the Google Maps API encompasses numerous endpoints, contributions are highly appreciated to expand and enhance this package.
If you find this package useful, please give it a like and star it on GitHub to support its popularity!
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.