getGroupMembers method

Future<List<String>> getGroupMembers(
  1. String groupId
)

Gets all members of a group

Implementation

Future<List<String>> getGroupMembers(String groupId) async {
  try {
    final docSnapshot = await _firestore.collection(_collectionPath).doc(groupId).get();

    if (docSnapshot.exists) {
      final data = docSnapshot.data();
      if (data != null && data['members'] != null) {
        return List<String>.from(data['members']);
      }
    }

    return [];
  } catch (e) {
    print('Error getting group members: $e');
    rethrow;
  }
}