UserLocation.fromMap constructor
//////////// //////////// Creates a UserLocation from a Firestore document map
Implementation
// II.C - Factory Methods
///////////////
/// Creates a UserLocation from a Firestore document map
factory UserLocation.fromMap(Map<String, dynamic> map, String userId) {
return UserLocation(
userId: userId,
location: map['location'] as GeoPoint? ?? GeoPoint(0, 0),
timestamp: map['timestamp'] as Timestamp? ?? Timestamp.now(),
speed: map['speed'] as double?,
heading: map['heading'] as double?,
accuracy: map['accuracy'] as double?,
);
}