find_min_distance 1.0.2 copy "find_min_distance: ^1.0.2" to clipboard
find_min_distance: ^1.0.2 copied to clipboard

A Dart package to calculate the minimum distance between two locations using latitude and longitude.

โœ๏ธ Author #

Vansh Bhardwaj
๐Ÿ“ง vanshbhardwajhere@gmail.com
๐Ÿ”— GitHub

find_min_distance #

Pub Version Likes Pub Points Dart SDK

A Dart utility package to calculate the minimum distance between two geographical locations using their latitude and longitude coordinates.
It uses the Haversine formula to accurately compute great-circle distances between points on a sphere.


๐Ÿš€ Features #

  • ๐Ÿ” Pure Dart implementation โ€“ no external dependencies
  • ๐Ÿ“ Calculate geo-distance in kilometers
  • ๐Ÿงฎ Uses Haversine formula for high accuracy
  • โœ… Fully tested & documented
  • ๐Ÿงฉ Works in both Flutter and pure Dart projects

๐Ÿ“ฆ Installation #

Add this to your pubspec.yaml:

dependencies:
  find_min_distance: ^1.0.2

Then, run:

flutter pub get

or for Dart only:

dart pub get

๐Ÿ’ป Usage Example #

import 'package:find_min_distance/find_min_distance.dart';

void main() {
  double lat1 = 28.7041; // New Delhi
  double lon1 = 77.1025;
  double lat2 = 19.0760; // Mumbai
  double lon2 = 72.8777;

  // Calculate minimum distance in KM
  double distance = calculateMinDistance(lat1, lon1, lat2, lon2);

  print("The distance between New Delhi and Mumbai is ${distance.toStringAsFixed(2)} km");
}

๐Ÿ“Œ Output: #

The distance between New Delhi and Mumbai is 1153.24 km

๐Ÿง  How it Works (Haversine Formula) #

The Haversine formula determines the great-circle distance between two points on a sphere using their latitudes and longitudes.
It is ideal for calculating as-the-crow-flies distances over the Earthโ€™s surface.


๐Ÿ“œ License #

This project is licensed under the MIT License โ€“ see the LICENSE file for details.

3
likes
160
points
26
downloads

Publisher

unverified uploader

Weekly Downloads

A Dart package to calculate the minimum distance between two locations using latitude and longitude.

Repository (GitHub)
View/report issues

Topics

#geolocation #distance #utility

Documentation

API reference

License

MIT (license)

More

Packages that depend on find_min_distance