GeoMethods class

Provides methods to call Google places, geocode and directions APIs

Constructors

GeoMethods.new({required String googleApiKey, required String language, String countryCode = '', List<String> countryCodes = const <String>[], String country = '', String city = '', DirectionsMode mode = DirectionsMode.driving, DirectionsUnits units = DirectionsUnits.metric})
Contructor for GeoMethods.

Properties

city String
City to filter address results.
final
country String
Country to filter address results.
final
countryCode String
Country code to search routes in a specific region. List of countries here.
final
countryCodes List<String>
Country code to search and autocomplete addresses filtering up to 5 countries . List of countries here.
final
googleApiKey String
Google api key to call Google APIs. Get one here.
final
hashCode int
The hash code for this object.
no setterinherited
language String
Language for responses from Google APIs. Language support list here.
final
mode DirectionsMode
By default, directions are calculated as driving directions. It can also be walking, bicycling, transit. See documentation.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
units DirectionsUnits
By default, directions are calculated using the metric system. It can also be imperial. See [https://developers.google.com/maps/documentation/javascript/directions#UnitSystems).
final

Methods

autocompletePlace({required String query}) Future<List<Address>>
Calls AutoComplete of Google Place API sending a query. Each Address just have reference and place_id.
copyWith({String? apiKeyParam, String? languageParam, String? countryCodeParam, List<String>? countryCodesParam, String? countryParam, String? cityParam, DirectionsMode? modeParam, DirectionsUnits? untisParam}) GeoMethods
Permits to use an GeoMethods copy with updated data.
geoLocatePlace({required Coords coords}) Future<Address?>
Calls Google Geocode API sending latitude and longitude of Coords.
getDirections({required Address origin, required Address destination, List<Address> waypoints = const <Address>[]}) Future<Directions?>
Calls Google Directions API sending origin, destination and waypoints Coords.
getPlaceGeometry({required String? reference, required String placeId}) Future<Address?>
Calls Details of Google Place API sending a place_id.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

decodeEncodedPolyline(String encoded) List<Coords>
Decodes an encoded String to create a Polyline.