removeMember method
- String userId
Removes a member from the group
Implementation
Group removeMember(String userId) {
if (userId == createdBy) {
throw Exception('Cannot remove the group creator');
}
final newMembers = members.where((id) => id != userId).toList();
return copyWith(members: newMembers);
}