Skip to content
pubscout

es_compression

2.0.16, released 3 weeks ago by instantiations.com

Compression framework providing FFI implementations for Brotli, Lz4, and Zstd.

WASM-ready
$ flutter pub add es_compression
Source repository

What it does

Provides a compression framework in Dart with FFI implementations for Brotli, Lz4, and Zstd (Zstandard), along with ready-to-use prebuilt binaries for Windows, Linux, and macOS. It also includes an executable tool 'escompress' for command-line file compression.

AI-written summary of version 2.0.16, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need Brotli, Lz4, or Zstd compression algorithms in your Dart or Flutter application.
  • You want FFI-based performance for compression tasks on desktop or mobile platforms.
  • You need a command-line tool to encode/decode compressed files.

Skip it when

  • You are running heavily on the web where native FFI shared libraries are unavailable and require pure Dart solutions.
  • You only require basic GZip compression which is already built into the standard Dart SDK (`dart:io`).

Strengths

  • Supports multiple efficient compression algorithms (Brotli, Lz4, Zstd).
  • Comes with ready-to-use prebuilt binaries for major desktop and mobile environments.
  • Flexible library loader supporting custom paths and environment variables.

Weaknesses

  • Requires managing and bundling native shared libraries (.dll, .so, .dylib) for target platforms.
  • Mac OS binaries require manual security allowance unless signed.

Setup

Kind
FFI (native library)
Effort
Medium
Code generation
No
Direct dependencies
4

FFI-based implementations require access to native shared libraries (.dll, .so, .dylib). Android projects require placing prebuilt .so files in jniLibs and updating build.gradle.

import 'dart:convert';
import 'package:es_compression/brotli.dart';
import 'package:es_compression/lz4.dart';
import 'package:es_compression/zstd.dart';

void main() {
  final bytes = utf8.encode('Hello Dart');
  for (final codec in [brotli, lz4, zstd]) {
    final encoded = codec.encode(bytes);
    final decoded = codec.decode(encoded);
    print(utf8.decode(decoded));
  }
}

Alternatives

Packages that do the same job and could replace es_compression.

  • zstandard

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

  • gzip

    A lightweight package for gzip compression and decompression.

  • brotli

    Pure Dart Brotli decoder

  • flutter_olm

    Builds the native Olm library for Android and iOS to be used via dart:ffi.

Works with

Packages commonly used together with es_compression: ones it builds on, ones built on it, and its own family.