Created
January 8, 2023 13:12
-
-
Save FlutterWiz/a9a855d297032420e1869b572529838b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void selectUserWhenCreatingAGroup({ | |
required User user, | |
required bool isCreateNewChatPageForCreatingGroup, | |
}) { | |
final listOfSelectedUserIDs = {...state.listOfSelectedUserIDs}; | |
final listOfSelectedUsers = {...state.listOfSelectedUsers}; | |
if (!isCreateNewChatPageForCreatingGroup) { | |
if (listOfSelectedUserIDs.isEmpty) { | |
listOfSelectedUserIDs.add(user.id); | |
listOfSelectedUsers.add(user); | |
} | |
emit( | |
state.copyWith( | |
listOfSelectedUserIDs: listOfSelectedUserIDs, | |
listOfSelectedUsers: listOfSelectedUsers, | |
), | |
); | |
} else if (isCreateNewChatPageForCreatingGroup) { | |
listOfSelectedUserIDs.add(user.id); | |
listOfSelectedUsers.add(user); | |
emit( | |
state.copyWith( | |
listOfSelectedUserIDs: listOfSelectedUserIDs, | |
listOfSelectedUsers: listOfSelectedUsers, | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment