Location class

Inheritance

Constructors

Location({double? longitude, double? latitude, DateTime? timestamp, bool? mocked, double? accuracy, double? altitude, double? heading, double? speed, double? speedAccuracy})
Location.fromJson(Map<String, dynamic> json)
factory

Properties

accuracy double
The estimated horizontal accuracy of the location in meters.
final
altitude double
The altitude of the device in meters.
final
hashCode int
The hash code for this object.
no setterinherited
heading double
The heading in which the device is traveling in degrees.
final
isEmpty bool
no setter
isNotEmpty bool
no setter
latitude double
The latitude of this location in degrees normalized to the interval -90.0 to +90.0 (both inclusive).
final
longitude double
The longitude of the location in degrees normalized to the interval -180 (exclusive) to +180 (inclusive).
final
mocked bool
Indicate if location was created from a mock provider.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
speed double
The speed at which the devices is traveling in meters per second over ground.
final
speedAccuracy double
The estimated speed accuracy of this location, in meters per second.
final
timestamp DateTime
The time at which this location was determined.
final

Methods

copyWith({double? latitude, double? longitude, double? accuracy, double? altitude, double? heading, double? speed, double? speedAccuracy, DateTime? timestamp, bool? mocked}) Location
distanceTo({double? latitude, double? longitude, Location? location}) double
Using Haversine formula
fastDistanceTo({double? latitude, double? longitude, Location? location}) double
Using Euclidean formula
fromJsonList(List? jsonList) List<Location>?
inherited
fromJsonMap(Map<String, dynamic>? json) Location?
override
fromJsonString(String? json) Location?
inherited
fromJsonStringList(String? jsonStringList) List<Location>?
inherited
isDifferentThan(Location? location) bool
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
override
toJsonMap() Map<String, dynamic>
inherited
toJsonString() String
inherited
toString() String
This is just to suggest children to implement a named constructor to support creating objects fromJson(...) and fromJsonString(...) as easy as T.build().fromJson(...) or T.build().fromJsonString(...)
inherited

Operators

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

Static Methods

distanceBetween(double lat1, double lng1, double lat2, double lng2) double
Returns the distance between 2 points of coordinates with Haversine formula
fastDistanceBetween(double lat1, double lng1, double lat2, double lng2) double
Calculate the Euclidean distance from this point to another using the Pythagorean theorem.