up and download data

This commit is contained in:
2026-01-16 15:24:37 +01:00
parent 49886655fd
commit dbc1252744
10 changed files with 271 additions and 7 deletions

View File

@@ -0,0 +1,15 @@
import 'dart:convert';
// ignore: avoid_web_libraries_in_flutter
import 'dart:html' as html;
void downloadJsonFileWeb(String jsonData, String fileName) {
final bytes = utf8.encode(jsonData);
final blob = html.Blob([bytes]);
final url = html.Url.createObjectUrlFromBlob(blob);
final anchor = html.AnchorElement(href: url)
..setAttribute('download', fileName)
..click();
html.Url.revokeObjectUrl(url);
}