TrackingStats.fromMap constructor
TrackingStats.fromMap(
- Map<String, dynamic> map
)
Implementation
factory TrackingStats.fromMap(Map<String, dynamic> map) {
return TrackingStats(
totalLocations: map['totalLocations'] ?? 0,
foregroundLocations: map['foregroundLocations'] ?? 0,
backgroundLocations: map['backgroundLocations'] ?? 0,
firstLocationTime: map['firstLocationTime'] != null
? DateTime.fromMillisecondsSinceEpoch(map['firstLocationTime'])
: null,
lastLocationTime: map['lastLocationTime'] != null
? DateTime.fromMillisecondsSinceEpoch(map['lastLocationTime'])
: null,
totalDistance: (map['totalDistance'] ?? 0.0).toDouble(),
averageSpeed: (map['averageSpeed'] ?? 0.0).toDouble(),
);
}