toMap method

Map<String, dynamic> toMap()

//////////// //////////// Converts UserLocation to a map for Firestore

Implementation

// II.D - Conversion Methods
///////////////
/// Converts UserLocation to a map for Firestore
Map<String, dynamic> toMap() {
  final map = {
    'userId': userId,
    'location': location,
    'timestamp': timestamp,
  };

  if (speed != null) map['speed'] = speed!;
  if (heading != null) map['heading'] = heading!;
  if (accuracy != null) map['accuracy'] = accuracy!;

  return map;
}