geo_distance_calculator

Last updated:

0 purchases

geo_distance_calculator Image
geo_distance_calculator Images
Add to Cart

Description:

geo distance calculator

GeoDistanceCalculator #
A simple Flutter library for calculating the distance between two geographical points using the Haversine formula.
Features #

Calculate the great-circle distance between two points on Earth.
Simple and easy-to-use API.

Installation #
Add this to your package's pubspec.yaml file:
dependencies:
geo_distance_calculator: ^1.0.0
copied to clipboard
Then, run the following command:
flutter pub get
copied to clipboard
Or, if you're using Dart:
dart pub get
copied to clipboard
Usage #
Import the package into your Dart file:
import 'package:geo_distance_calculator/geo_distance_calculator.dart';
copied to clipboard
You can then use the GeoDistanceCalculator class to calculate the distance between two geographical points:
double distance = GeoDistanceCalculator.calculateDistance(
startLatitude: 37.7749,
startLongitude: -122.4194,
endLatitude: 34.0522,
endLongitude: -118.2437,
);

print('The distance is $distance kilometers');
copied to clipboard
Example #
void main() {
double distance = GeoDistanceCalculator.calculateDistance(
startLatitude: 21.0285, // Hanoi
startLongitude: 105.8542,
endLatitude: 10.8231, // Ho Chi Minh City
endLongitude: 106.6297,
);

print('The distance between Hanoi and Ho Chi Minh City is $distance kilometers');
}
copied to clipboard
License #
This project is licensed under the MIT License - see the LICENSE file for details.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.