LocationUpdate.fromLocationData constructor Null safety
Create a LocationUpdate using
- a
location
distance
in meters from the start- duration
elapsed
since the start - the
averageSpeed
of the user in km/h - the current
speed
of the runner in meters per second
Implementation
factory LocationUpdate.fromLocationData({
required Location location,
required num distance,
required num speed,
required Duration elapsed,
double averageSpeed = 0,
}) =>
LocationUpdate(
id: location.uuid,
metersPassed: distance,
speed: speed,
longitude: location.coords.longitude,
latitude: location.coords.latitude,
timestamp: location.timestamp,
accuracy: location.coords.accuracy,
originalLocation: location,
timeElapsed: elapsed,
averageSpeed: averageSpeed,
);