Distance class

Calculates the distance between points.

Default algorithm is distanceWithVincenty, default radius is earthRadius

 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()})
Radius must be greater than 0.

Properties

calculator DistanceCalculator
Returns either Haversine oder Vincenty calculator
no setter
hashCode int
The hash code for this object.
no setterinherited
radius double
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

as(LengthUnit unit, LatLng p1, LatLng p2) double
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) double
Shortcut for distance
distance(LatLng p1, LatLng p2) double
Computes the distance between two points.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent 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