toMap method
Converts to a JSON-serializable map.
Implementation
JsonMap toMap() => {
'totalDistanceMeters': totalDistanceMeters,
'movingDurationSeconds': movingDuration.inSeconds,
'stationaryDurationSeconds': stationaryDuration.inSeconds,
'locationCount': locationCount,
if (averageSpeedMps != null) 'averageSpeedMps': averageSpeedMps,
if (maxSpeedMps != null) 'maxSpeedMps': maxSpeedMps,
if (periodStart != null) 'periodStart': periodStart!.toIso8601String(),
if (periodEnd != null) 'periodEnd': periodEnd!.toIso8601String(),
'frequentLocations': frequentLocations.map((l) => l.toMap()).toList(),
if (averageAccuracyMeters != null)
'averageAccuracyMeters': averageAccuracyMeters,
'totalDistanceKm': totalDistanceKm,
'movingPercent': movingPercent,
};