find_min_distance 1.0.2

SDKdartflutter
Platformandroidioswindowslinuxmacosweb

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.