Faizan Abbas Bangash
Faizan Abbas Bangash

Reputation: 117

How to zip file after getting files from storage?

How to zip files from list?

Path of my list:

files[index].path;

Flutter archive package code:

 final sourceDir = Directory("source_dir");
 final files = [
  File(sourceDir.path + "file1"),
   File(sourceDir.path + "file2")
  ];
  final zipFile = File("zip_file_path");
   try {
    ZipFile.createFromFiles(
     sourceDir: sourceDir, files: files, zipFile: zipFile);
     } catch (e) {
      print(e);
     }

Upvotes: 0

Views: 394

Answers (1)

Abdullatif Eida
Abdullatif Eida

Reputation: 247

By using this package flutter_archive: ^5.0.0 you can zip file after getting files from storage

Upvotes: 2

Related Questions