Distance class

Calculates the distance between points.

Default algorithm is distanceWithVincenty, default radius is EARTH_RADIUS

 final Distance distance = new Distance();

 // km = 423
 final int km = distance.as(LengthUnit.Kilometer,
    new LatLng(52.518611,13.408056),new LatLng(51.519475,7.46694444));

 // meter = 422592
 final int meter = distance(new LatLng(52.518611,13.408056),new LatLng(51.519475,7.46694444));
Implemented types
Implementers

Constructors

Distance({bool roundResult = true, DistanceCalculator calculator = const Vincenty()})
const
Distance.withRadius(double radius, {bool roundResult = true, DistanceCalculator calculator = const Vincenty()})

Properties

calculator DistanceCalculator
Returns either Haversine oder Vincenty calculator [...]
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
radius double
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

as(LengthUnit unit, LatLng p1, LatLng p2) num
Converts the distance to the given LengthUnit [...]
bearing(LatLng p1, LatLng p2) double
Returns the great circle bearing (direction) in degrees to the next point (p2) [...]
call(LatLng p1, LatLng p2) num
Shortcut for distance
distance(LatLng p1, LatLng p2) num
Computes the distance between two points. [...]
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
offset(LatLng from, num distanceInMeter, num bearing) LatLng
Returns a destination point based on the given distance and bearing [...]
override
toString() String
A string representation of this object. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited