getLocationUpdates method

Stream<List<UserLocation>> getLocationUpdates(
  1. String groupId
)

Gets real-time location updates for all users in a group

Implementation

Stream<List<UserLocation>> getLocationUpdates(String groupId) {
  try {
    return _firestore
        .collection(_collectionPath)
        .doc(groupId)
        .collection(_locationSubcollection)
        .snapshots()
        .map((snapshot) {
          return snapshot.docs.map((doc) {
            return UserLocation.fromMap(doc.data(), doc.id);
          }).toList();
        });
  } catch (e) {
    print('Error getting location updates: $e');
    rethrow;
  }
}