LocationDto class
Data transfer object representing a single location update.
LocationDto contains all the information about a location point including coordinates, accuracy, altitude, speed, and heading. It is used to pass location data from the native platform to the Dart/Flutter code.
All distance measurements are in meters, speed in meters per second, and heading in degrees (0-360).
Example:
LocationDto location = LocationDto.fromJson(jsonData);
print('Latitude: ${location.latitude}');
print('Longitude: ${location.longitude}');
print('Accuracy: ${location.accuracy}m');
print('Speed: ${location.speed}m/s');
Constructors
- LocationDto.fromJson(Map json)
-
Creates a LocationDto from a JSON map.
factory
Properties
- accuracy → double
-
The accuracy of the location in meters.
Lower values indicate higher accuracy.
final
- altitude → double
-
The altitude above sea level in meters.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- heading → double
-
The heading (direction) of movement in degrees (0-360).
0 degrees represents true north.
final
- isMocked → bool
-
Whether this location was obtained from a mock provider.
On iOS, this is always false. On Android, it indicates if the location
came from a mock location app.
final
- latitude → double
-
The latitude coordinate of the location.
final
- longitude → double
-
The longitude coordinate of the location.
final
- provider → String
-
The name of the location provider (e.g., 'gps', 'network', 'fused').
Android-specific field.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- speed → double
-
The speed of movement in meters per second.
final
- speedAccuracy → double
-
The accuracy of the speed measurement in meters per second.
final
- time → double
-
The timestamp of the location in milliseconds since epoch.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts this LocationDto to a JSON map.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited