Skip to content

Commit

Permalink
fix filesaver for web
Browse files Browse the repository at this point in the history
  • Loading branch information
julien4215 committed Jun 6, 2024
1 parent 6e90e22 commit b51c0d9
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions lib/ph/ui/pages/past_ph_selection_page/ph_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,19 @@ class PhList extends HookConsumerWidget {
dataBuilder: (context, pdf) => PhCard(
ph: ph,
onDownload: () async {
final path = await FileSaver.instance.saveAs(
name: ph.name,
bytes: pdf.last,
ext: "pdf",
mimeType: MimeType.pdf,
); // Not yet possible to save directly the file to Download folder
final path = kIsWeb
? await FileSaver.instance.saveFile(
name: ph.name,
bytes: pdf.last,
ext: "pdf",
mimeType: MimeType.pdf,
)
: await FileSaver.instance.saveAs(
name: ph.name,
bytes: pdf.last,
ext: "pdf",
mimeType: MimeType.pdf,
);
if (path != null) {
displayPhToastWithContext(
TypeMsg.msg,
Expand Down

0 comments on commit b51c0d9

Please sign in to comment.