joinGroup method

Future<void> joinGroup(
  1. String userId,
  2. String groupId
)

//////////// //////////// Adds a user to a group

Implementation

// II.C - Membership Operations
///////////////
/// Adds a user to a group
Future<void> joinGroup(String userId, String groupId) async {
  try {
    await _firestore.collection(_collectionPath).doc(groupId).update({
      'members': FieldValue.arrayUnion([userId]),
    });
  } catch (e) {
    print('Error joining group: $e');
    rethrow;
  }
}