downloadAs method
- PostItem item
Downloads the provided PostItem using save as
dialog.
Implementation
Future<void> downloadAs(PostItem item) async {
Log.debug('downloadAs($item)', '$runtimeType');
try {
final String? to = await FilePicker.platform.saveFile(
fileName: item.attachment.original.name,
type: item.attachment is ImageAttachment
? FileType.image
: FileType.video,
lockParentWindow: true,
);
if (to != null) {
await download(item, to: to);
}
} catch (_) {
MessagePopup.error('err_could_not_download'.l10n);
rethrow;
}
}