google_directions_api 0.10.0 copy "google_directions_api: ^0.10.0" to clipboard
google_directions_api: ^0.10.0 copied to clipboard

The Directions API is a service that calculates directions between locations. You can search for directions for several modes of transportation.

google_directions_api #

Build Pub GitHub GitHub stars

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

Usage #

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.

TODO #

  • Write tests via mocks
54
likes
140
points
1.96k
downloads

Publisher

verified publisherthisismarch.dev

Weekly Downloads

The Directions API is a service that calculates directions between locations. You can search for directions for several modes of transportation.

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flinq, google_polyline_algorithm, http

More

Packages that depend on google_directions_api