Skip to main content

zstandard 1.5.5 copy "zstandard: ^1.5.5" to clipboard
zstandard: ^1.5.5 copied to clipboard

Flutter plugin for fast Zstandard compression and decompression across native and WebAssembly platforms.

pub package

Zstandard #

Zstandard (zstd) is a fast, high-compression algorithm developed by Meta (formerly Facebook) for real-time applications. It offers a broad range of compression levels, supporting both high-speed and high-compression-ratio requirements, making it ideal for data storage, transmission, and backup solutions.

This Flutter plugin provides a native implementation of the zstd compression algorithm. It integrates the zstd library in C through FFI for native platforms (Android, iOS, Windows, macOS, and Linux), ensuring efficient compression and decompression. On the web, it leverages WebAssembly to deliver the same high-performance compression. This plugin enables seamless, cross-platform data compression, suitable for applications needing fast, efficient data processing.

Android iOS Web macOS Windows Linux Fuchsia
Status ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ❌
Native FFI FFI WebAssembly FFI FFI FFI ❌
Precompiled No No Yes (wasm) No No No ❌

Note: The C files for the compression library are sourced from the official facebook/zstd repository.

For command-line usage on desktops, refer to the zstandard_cli package.

Basic Usage #

void act() async {
  final zstandard = Zstandard();

  Uint8List original = Uint8List.fromList([...]);

  Uint8List? compressed = await zstandard.compress(original);
  
  final decompressed = compressed == null
      ? null
      : await zstandard.decompress(compressed);
}

With extension functions:

void act() async {
  Uint8List original = Uint8List.fromList([...]);

  Uint8List? compressed = await original.compress();
  
  final decompressed = await compressed.decompress();
}

Compression always emits a valid zstd frame, including for empty input. Decompression supports concatenated frames and frames without a declared content size. It returns null for malformed or truncated input and limits output to 256 MiB by default. Pass maxOutputSize to decompress (including the extension method) to choose a smaller application-specific budget.

Below are examples of the plugin in action across different platforms.

12
likes
160
points
49.6k
downloads

Documentation

API reference

Publisher

verified publishervyp.dev

Weekly Downloads

Flutter plugin for fast Zstandard compression and decompression across native and WebAssembly platforms.

Homepage
Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

Dependencies

flutter, zstandard_android, zstandard_ios, zstandard_linux, zstandard_macos, zstandard_platform_interface, zstandard_web, zstandard_windows

More

Packages that depend on zstandard

Packages that implement zstandard