Skip to content

Instantly share code, notes, and snippets.

@adityadroid
Created October 6, 2019 18:38
Show Gist options
  • Select an option

  • Save adityadroid/64fd2e1379d85b8b8bcd626d0a8de30c to your computer and use it in GitHub Desktop.

Select an option

Save adityadroid/64fd2e1379d85b8b8bcd626d0a8de30c to your computer and use it in GitHub Desktop.
showFilePicker(FileType fileType) async {
File file;
if (fileType == FileType.IMAGE && SharedObjects.prefs.getBool(Constants.configImageCompression))
file = await ImagePicker.pickImage(
source: ImageSource.gallery, imageQuality: 70);
else
file = await FilePicker.getFile(type: fileType);
if (file == null) return;
chatBloc.dispatch(SendAttachmentEvent(chat.chatId, file, fileType));
Navigator.pop(context);
GradientSnackBar.showMessage(context, 'Sending attachment..');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment