// 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); }