feat(frontend): download responsable history csv

This commit is contained in:
SaidSoighiri94
2026-07-23 09:42:01 +02:00
parent 95c9080777
commit c85fab8ca3
4 changed files with 120 additions and 11 deletions
+21
View File
@@ -0,0 +1,21 @@
// ignore_for_file: avoid_web_libraries_in_flutter, deprecated_member_use
import "dart:html" as html;
import "dart:typed_data";
void downloadFile({
required Uint8List bytes,
required String fileName,
required String contentType,
}) {
final blob = html.Blob([bytes], contentType);
final url = html.Url.createObjectUrlFromBlob(blob);
final anchor = html.AnchorElement(href: url)
..download = fileName
..style.display = "none";
html.document.body?.children.add(anchor);
anchor.click();
anchor.remove();
html.Url.revokeObjectUrl(url);
}