leaveGroup method

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

Implementation

Future<void> leaveGroup(String userId, String groupId) async {
  UserData user = await getUserData(userId);
  List<String> joinedGroups = user.joinedGroups;
  joinedGroups.remove(groupId);
  await modifyUserData(
      userId,
      UserData(
          currentEvents: user.currentEvents,
          name: user.name,
          email: user.email,
          userId: userId,
          grade: user.grade,
          points: user.points,
          pastEvents: user.pastEvents,
          pastPoints: user.pastPoints,
          joinedGroups: joinedGroups,
          profilePic: user.profilePic,
          pendingPurchasedItems: user.pendingPurchasedItems,
          spendablePoints: user.spendablePoints));
}