google_routes_flutter 1.0.0+1 copy "google_routes_flutter: ^1.0.0+1" to clipboard
google_routes_flutter: ^1.0.0+1 copied to clipboard

A dart interface for the Google Maps Routes API, which can be used to request directions between two or more locations.

This package is a dart interface to the google routes api. It allows you to get information about routes between locations, such as distance, travel time, etc.

Features #

  • computeRoute
  • computeRouteMatrix

Getting started #

Just add the package to your pubspec.yaml file:

dart pub add google_routes_flutter

Usage #

computeRoute #

Computes a route between 2 points.

    var computeRoutesResult = await computeRoute(
      origin: Waypoint(
        location: Location(
          latLng: LatLng(
            latitude: 33.25889341635255,
            longitude: 35.210018284644185,
          ),
        ),
      ),
      destination: Waypoint(
        location: Location(
          latLng: LatLng(
            latitude: 33.278430320176085,
            longitude: 35.216819613960894,
          ),
        ),
      ),
      xGoogFieldMask: 'routes.distanceMeters,routes.routeLabels',
      apiKey: 'YOUR_API_KEY',
    );

computeRouteMatrix #

Computes a route between each origin/destination pair of the provided origins and destinations lists

    var computeRouteMatrixResult = await computeRouteMatrix(
      origins: [
        RouteMatrixOrigin(
          waypoint: Waypoint(
            location: Location(
              latLng: LatLng(
                latitude: 33.25889341635255,
                longitude: 35.210018284644185,
              ),
            ),
          ),
        ),
      ],
      destinations: [
        RouteMatrixDestination(
          waypoint: Waypoint(
            location: Location(
              latLng: LatLng(
                latitude: 33.278430320176085,
                longitude: 35.216819613960894,
              ),
            ),
          ),
        ),
      ],
      xGoogFieldMask: 'distanceMeters',
      apiKey: 'YOUR_API_KEY',
    );

Contributing #

  • Feel free to open an issue if you have any problem or suggestion.
  • Feel free to open a pull request if you want to contribute.

Want to say thanks? #

"Buy Me A Coffee"

7
likes
150
pub points
66%
popularity

Publisher

unverified uploader

A dart interface for the Google Maps Routes API, which can be used to request directions between two or more locations.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

http, json_annotation

More

Packages that depend on google_routes_flutter