pick function
- dynamic lang,
- dynamic pinAttachmentType
Implementation
Future<FilePickerResult?> pick(
L10n lang, AttachmentType pinAttachmentType,) async {
if (pinAttachmentType == AttachmentType.image) {
return await pickImage(lang: lang);
}
return await FilePicker.platform.pickFiles(
type: switch (pinAttachmentType) {
AttachmentType.video => FileType.video,
AttachmentType.audio => FileType.audio,
_ => FileType.any,
},
);
}