downloadFile function

Future<bool> downloadFile(
  1. dynamic context,
  2. File file
)

Implementation

Future<bool> downloadFile(BuildContext context, File file) async {
  final lang = L10n.of(context);
  final filename = basename(file.path);
  String? outputFile = await FilePicker.platform.saveFile(
    dialogTitle: lang.downloadFileDialogTitle,
    fileName: filename,
  );

  if (outputFile == null) {
    return false;
  }

  await file.copy(outputFile);
  EasyLoading.showToast(lang.downloadFileSuccess(outputFile));
  return true;
}