Skip to main content

apiverve_distancecalculator 1.2.3 copy "apiverve_distancecalculator: ^1.2.3" to clipboard
apiverve_distancecalculator: ^1.2.3 copied to clipboard

Distance Calculator computes the distance between two coordinate pairs in miles and kilometers. Supply two latitude and longitude points to receive distances and resolved city and state names for both [...]

Distance Calculator API - Dart/Flutter Client #

Distance Calculator computes the distance between two coordinate pairs in miles and kilometers. Supply two latitude and longitude points to receive distances and resolved city and state names for both locations.

pub package License: MIT

This is the Dart/Flutter client for the Distance Calculator API.

Installation #

Add this to your pubspec.yaml:

dependencies:
  apiverve_distancecalculator: ^1.2.3

Then run:

dart pub get
# or for Flutter
flutter pub get

Usage #

import 'package:apiverve_distancecalculator/apiverve_distancecalculator.dart';

void main() async {
  final client = DistancecalculatorClient('YOUR_API_KEY');

  try {
    final response = await client.execute({
      'lat1': 36.7783,
      'lon1': -119.4179,
      'lat2': 34.0522,
      'lon2': -118.2437
    });

    print('Status: ${response.status}');
    print('Data: ${response.data}');
  } catch (e) {
    print('Error: $e');
  }
}

Response #

{
  "status": "ok",
  "error": null,
  "data": {
    "distanceMiles": 199.6804337234997,
    "distanceKm": 321.2535462758628,
    "location1": {
      "latitude": "36.728450",
      "longitude": "-119.53571",
      "city": "Sanger",
      "state": "California"
    },
    "location2": {
      "latitude": "34.044662",
      "longitude": "-118.24255",
      "city": "Los Angeles",
      "state": "California"
    },
    "bearing": 198,
    "direction": "South",
    "estimatedDriveTime": "5h 11m"
  }
}

API Reference #

Authentication #

All requests require an API key. Get yours at apiverve.com.

License #

MIT License - see LICENSE for details.


Built with Dart for APIVerve

0
likes
120
points
32
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Distance Calculator computes the distance between two coordinate pairs in miles and kilometers. Supply two latitude and longitude points to receive distances and resolved city and state names for both locations.

Homepage
Repository (GitHub)
View/report issues
Contributing

License

MIT (license)

Dependencies

http, http_parser

More

Packages that depend on apiverve_distancecalculator