Skip to content

Instantly share code, notes, and snippets.

@FlutterWiz
Created January 8, 2023 13:05
Show Gist options
  • Select an option

  • Save FlutterWiz/fc90f977520f914421b1d9fba98f978a to your computer and use it in GitHub Desktop.

Select an option

Save FlutterWiz/fc90f977520f914421b1d9fba98f978a to your computer and use it in GitHub Desktop.
Future<void> sendCapturedPhotoToSelectedUsers({
required String pathOfTheTakenPhoto,
required int sizeOfTheTakenPhoto,
}) async {
if (state.isInProgress) {
return;
}
emit(state.copyWith(isInProgress: true));
final channelId = state.currentUserChannels[state.userIndex].id;
// For showing the progress indicator, and well UX.
await Future.delayed(const Duration(seconds: 1));
await _chatService.sendPhotoAsMessageToTheSelectedUser(
channelId: channelId!,
pathOfTheTakenPhoto: pathOfTheTakenPhoto,
sizeOfTheTakenPhoto: sizeOfTheTakenPhoto,
);
emit(state.copyWith(isInProgress: false, isCapturedPhotoSent: true));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment