Skip to content

Instantly share code, notes, and snippets.

@alperefesahin
Created January 8, 2023 13:15
Show Gist options
  • Save alperefesahin/f65237c7bfa2f60667ed01a981a869b5 to your computer and use it in GitHub Desktop.
Save alperefesahin/f65237c7bfa2f60667ed01a981a869b5 to your computer and use it in GitHub Desktop.
void selectUserToSendCapturedPhoto({
required User user,
required int userIndex,
}) {
final listOfSelectedUserIDs = {...state.listOfSelectedUserIDs};
if (listOfSelectedUserIDs.isEmpty) {
listOfSelectedUserIDs.add(user.id);
}
emit(
state.copyWith(listOfSelectedUserIDs: listOfSelectedUserIDs, userIndex: userIndex),
);
}
void removeUserToSendCapturedPhoto({
required User user,
}) {
final listOfSelectedUserIDs = {...state.listOfSelectedUserIDs};
listOfSelectedUserIDs.remove(user.id);
emit(
state.copyWith(listOfSelectedUserIDs: listOfSelectedUserIDs, userIndex: 0),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment