attachment download WIP
This commit is contained in:
parent
04a871a293
commit
8eeb0b013d
7
lib/attachamentDownloadStub.dart
Normal file
7
lib/attachamentDownloadStub.dart
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import 'structs.dart';
|
||||||
|
|
||||||
|
class Attachmentdownload {
|
||||||
|
Future<void> saveFile(AttachmentResponse attachment) async {
|
||||||
|
print("stub attachment download");
|
||||||
|
}
|
||||||
|
}
|
@ -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)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
7
lib/attachmentDownloadAndroid.dart
Normal file
7
lib/attachmentDownloadAndroid.dart
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import 'structs.dart';
|
||||||
|
|
||||||
|
class Attachmentdownload {
|
||||||
|
Future<void> saveFile(AttachmentResponse attachment) async {
|
||||||
|
print("android attachment download");
|
||||||
|
}
|
||||||
|
}
|
12
lib/attachmentDownloadWeb.dart
Normal file
12
lib/attachmentDownloadWeb.dart
Normal 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)
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// }
|
Loading…
Reference in New Issue
Block a user