class that downloads the attachments

This commit is contained in:
Juan Marulanda De Los Rios 2025-04-23 15:54:56 -04:00
parent b200b1e443
commit f132ae69c1

View File

@ -0,0 +1,14 @@
import 'dart:html' as html;
import 'dart:io';
import 'structs.dart';
import 'package:file_saver/file_saver.dart';
class Attachmentdownload {
Future<void> saveFile(AttachmentResponse attachment) async {
await FileSaver.instance.saveFile(
name: attachment.name.toString().substring(0, attachment.name.toString().lastIndexOf('.')),
bytes: attachment.data,
ext: attachment.name.toString().substring(attachment.name.toString().lastIndexOf('.')+1)
);
}
}