Search packages, repositories and app categories

Package detailsv6.3.2

flutter_archive

Create and extract ZIP archive files in Android, iOS and macOS. Zip all files in a directory recursively or a given list of files.

AndroidiOSmacOS
30-day downloads
53.7K
Likes
171
Pub points
160

Install package

flutter pub add flutter_archive

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

flutter_archive is a Flutter package that enables creating and extracting ZIP archive files on Android, iOS, and macOS. It supports recursively zipping all files within a directory or a specified list of files. The package provides a straightforward API for handling compressed file operations, making it ideal for apps needing to bundle or decompress data. It integrates seamlessly with Flutter's ecosystem and is suitable for file management tasks involving archives.

Use cases

  • Exporting app data as ZIP
  • Backing up user files
  • Downloading and extracting compressed content
  • Sharing multiple files via ZIP
  • Handling app resource bundles

Key features

  • Supports ZIP creation and extraction
  • Recursive directory compression
  • Cross-platform compatibility (Android, iOS, macOS)
  • Simple API for file lists and directories
  • Lightweight and efficient

Suitable for

  • Apps requiring file archiving
  • Data export features
  • Offline file management
  • Backup and restore functionality
  • Mobile app developers targeting iOS and Android

Considerations

  • Requires platform-specific permissions for file access
  • Limited to ZIP format only
  • No built-in encryption support
  • File size limits depend on device memory
  • Not optimized for very large archives

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

flutter_archive

Create and extract ZIP archive files. Uses Android/iOS/macOS platform APIs for high performance and optimal memory usage.

Features

  • Supports Android (API level 24+), iOS 13+ and macOS 10.15+.
  • Modern plugin implementation based on Kotlin (Android) and Swift (iOS/macOS).
  • Uses background processing to keep UI responsive.
  • Zip all files in a directory (optionally recursively).
  • Zip a given list of files.
  • Unzip an archive file to a given directory.
  • Progress reporting.
  • Extract and zip files selectively (allows excluding files).

Examples

Create a zip file from a directory
  final dataDir = Directory("data_dir_path");
  try {
    final zipFile = File("zip_file_path");
    ZipFile.createFromDirectory(
        sourceDir: dataDir, zipFile: zipFile, recurseSubDirs: true);
  } catch (e) {
    print(e);
  }
Create a zip file from a given list of files.
  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);
  }
Extract a ZIP archive
  final zipFile = File("zip_file_path");
  final destinationDir = Directory("destination_dir_path");
  try {
    ZipFile.extractToDirectory(zipFile: zipFile, destinationDir: destinationDir);
  } catch (e) {
    print(e);
  }
Get progress info while extracting a zip archive.
  final zipFile = File("zip_file_path");
  final destinationDir = Directory("destination_dir_path");
  try {
    await ZipFile.extractToDirectory(
        zipFile: zipFile,
        destinationDir: destinationDir,
        onExtracting: (zipEntry, progress) {
          print('progress: ${progress.toStringAsFixed(1)}%');
          print('name: ${zipEntry.name}');
          print('isDirectory: ${zipEntry.isDirectory}');
          print(
              'modificationDate: ${zipEntry.modificationDate.toLocal().toIso8601String()}');
          print('uncompressedSize: ${zipEntry.uncompressedSize}');
          print('compressedSize: ${zipEntry.compressedSize}');
          print('compressionMethod: ${zipEntry.compressionMethod}');
          print('crc: ${zipEntry.crc}');
          return ZipFileOperation.includeItem;
        });
  } catch (e) {
    print(e);
  }

Categories

Source repository

Projects using this package