latlong2
0.10.1, released 7 months ago by femtopedia.de
Lightweight Dart library for latitude/longitude calculations.
WASM-ready
What it does
Provides functions to compute distances, bearings and offsets between coordinates using Haversine or Vincenty algorithms. Includes utilities for path smoothing and GeoJSON conversion. All calculations are pure Dart with no platform dependencies.
AI-written summary of version 0.10.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need fast, offline distance or bearing calculations.
- You want to smooth or equalize a series of GPS points without a map UI.
Skip it when
- You need a full map widget or tile rendering.
- You require real‑time location tracking or permissions handling.
Strengths
- Zero native dependencies, works on all Dart platforms
- Supports both fast Haversine and accurate Vincenty algorithms
- Path smoothing and GeoJSON helpers included
- Null‑safe and lightweight
Weaknesses
- Does not provide location services or map widgets
- Limited to calculation utilities, no visual components
- No built‑in caching or networking
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
final distance = Distance();
final km = distance.as(LengthUnit.Kilometer,
LatLng(52.518611, 13.408056), LatLng(51.519475, 7.46694444));Alternatives
Packages that do the same job and could replace latlong2.
- geolocator
Provides location services and distance calculations with platform integration, useful if you also need GPS permissions.
97Compare
Works with
Packages commonly used together with latlong2: ones it builds on, ones built on it, and its own family.
- intllatlong2 depends on itA Dart library for internationalization and localization, providing message translation, plural/gender handling, and date/number formatting.
- flutter_mapBuilt on latlong2Pure‑Flutter map client with tile loading, markers, and gestures
- flutter_map_marker_popupBuilt on latlong2Marker popups for flutter_map
- flutter_map_marker_clusterBuilt on latlong2A Dart implementation of Leaflet.makercluster for Flutter apps. Provides beautiful animated marker clustering functionality for flutter_map.
- vector_map_tilesBuilt on latlong2A flutter_map plugin that enables the use of vector tiles.
- flutter_map_location_markerBuilt on latlong2A flutter_map plugin for displaying the device's current location with a customizable marker.
- flutter_map_animationsBuilt on latlong2Animation utilities for markers and controls of the flutter_map package.
- pmtilesBuilt on latlong2A library for parsing Protomaps PMTiles files storing raster or vector map tiles.