Skip to content

Commit e072384

Browse files
committed
KB file added
1 parent f3d8e7c commit e072384

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/helper/save_file_web.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import 'dart:async';
2+
import 'dart:convert';
3+
import 'dart:html';
4+
5+
///To save the excel sheet in the web platform.
6+
Future<void> saveAndLaunchFile(List<int> bytes, String fileName) async {
7+
AnchorElement(
8+
href:
9+
'data:application/octet-stream;charset=utf-16le;base64,${base64.encode(bytes)}')
10+
..setAttribute('download', fileName)
11+
..click();
12+
}

0 commit comments

Comments
 (0)