attachment download WIP

This commit is contained in:
Juan Marulanda De Los Rios 2025-05-23 16:13:17 -04:00
parent 04a871a293
commit 8eeb0b013d
4 changed files with 29 additions and 15 deletions

View File

@ -0,0 +1,7 @@
import 'structs.dart';
class Attachmentdownload {
Future<void> saveFile(AttachmentResponse attachment) async {
print("stub attachment download");
}
}

View File

@ -1,15 +1,3 @@
import 'dart:html' as html; export 'attachamentDownloadStub.dart'
import 'package:web/web.dart' as web; if (dart.library.io) 'attachmentDownloadAndroid.dart';
import 'dart:io'; // if (dart.library.js_interop) 'attachmentDownloadWeb.dart';
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)
);
}
}

View File

@ -0,0 +1,7 @@
import 'structs.dart';
class Attachmentdownload {
Future<void> saveFile(AttachmentResponse attachment) async {
print("android attachment download");
}
}

View File

@ -0,0 +1,12 @@
// 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)
// );
// }
// }