mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-14 09:46:01 -07:00
feature(web): Added option to download file and copy stream url (#209)
Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
parent
54babaec89
commit
bd8faf2f6a
5 changed files with 61 additions and 18 deletions
11
lib/util/file_downloader.dart
Normal file
11
lib/util/file_downloader.dart
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import 'package:universal_html/html.dart' as html;
|
||||
|
||||
Future<void> downloadFile(String url) async {
|
||||
try {
|
||||
html.AnchorElement anchorElement = html.AnchorElement(href: url);
|
||||
anchorElement.download = url;
|
||||
anchorElement.click();
|
||||
} catch (e) {
|
||||
print('Download error: $e');
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue