https://github.com/marchdev-tk/google_directions_api
The Directions API is a service that calculates directions between locations. You can search for directions for several modes of transportation, including transit, driving, walking, or cycling.
https://github.com/marchdev-tk/google_directions_api
dart dart2 dartlang directions directions-api flutter flutter-package flutter-plugin google-maps google-maps-api
Last synced: 6 months ago
JSON representation
The Directions API is a service that calculates directions between locations. You can search for directions for several modes of transportation, including transit, driving, walking, or cycling.
- Host: GitHub
- URL: https://github.com/marchdev-tk/google_directions_api
- Owner: marchdev-tk
- License: bsd-3-clause
- Created: 2020-02-29T14:13:17.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-01-31T13:49:11.000Z (over 1 year ago)
- Last Synced: 2025-04-12T16:15:54.567Z (6 months ago)
- Topics: dart, dart2, dartlang, directions, directions-api, flutter, flutter-package, flutter-plugin, google-maps, google-maps-api
- Language: Dart
- Homepage:
- Size: 139 KB
- Stars: 16
- Watchers: 2
- Forks: 14
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Authors: AUTHORS
Awesome Lists containing this project
README
# google_directions_api

[](https://pub.dartlang.org/packages/google_directions_api)

The Directions API is a service that calculates directions between locations. You can search for directions for several modes of transportation, including transit, driving, walking, or cycling.
## Getting Started
The Directions API is a service that calculates directions between locations using an HTTP request.
With the Directions API, you can:
* Search for directions for several modes of transportation, including transit, driving, walking or cycling.
* Return multi-part directions using a series of waypoints.
* Specify origins, destinations, and waypoints as text strings (e.g. "Chicago, IL" or "Darwin, NT, Australia"), or as latitude/longitude coordinates, or as place IDs.The API returns the most efficient routes when calculating directions. Travel time is the primary factor optimized, but the API may also take into account other factors such as distance, number of turns and many more when deciding which route is the most efficient.
**Note**: This service is **not designed to respond in real time to user input**.
For full info about Directions API visit official [documentation](https://developers.google.com/maps/documentation/directions/intro#top_of_page)
### Usage
```dart
import 'package:google_directions_api/google_directions_api.dart';void main() {
DirectionsService.init('API_KEY');final directionsService = DirectionsService();
final request = DirectionsRequest(
origin: 'New York',
destination: 'San Francisco',
travelMode: TravelMode.driving,
);directionsService.route(request,
(DirectionsResult response, DirectionsStatus status) {
if (status == DirectionsStatus.ok) {
// do something with successful response
} else {
// do something with error response
}
});
}
```## Feature requests and Bug reports
Feel free to post a feature requests or report a bug [here](https://github.com/marchdev-tk/google_directions_api/issues).
## TODO
* Write tests via mocks