Skip to main content

zstandard_macos 1.5.1 copy "zstandard_macos: ^1.5.1" to clipboard
zstandard_macos: ^1.5.1 copied to clipboard

macOS implementation of the Zstandard compression plugin for Flutter applications.

pub package

zstandard_macos #

The macOS implementation of the zstandard Flutter plugin. Uses FFI and the native Zstandard C library.

Installation #

Add the main plugin to your app; this package is included automatically via the federated plugin:

dependencies:
  zstandard: ^1.5.0

No extra setup is required for normal use.

Usage #

Use the main zstandard API; the macOS implementation is selected automatically on macOS:

import 'package:zstandard/zstandard.dart';

void main() async {
  final zstandard = Zstandard();
  final data = Uint8List.fromList([1, 2, 3, 4, 5]);

  final compressed = await zstandard.compress(data, 3);
  final decompressed = await zstandard.decompress(compressed ?? Uint8List(0));
}

Or use the extension methods:

final compressed = await data.compress(compressionLevel: 3);
final decompressed = await compressed?.decompress();

API #

  • ZstandardMacOS() — Creates the macOS platform implementation.
  • compress(Uint8List data, int compressionLevel) — Compresses data (level 1–22). Returns compressed bytes or null.
  • decompressWithOptions(Uint8List data, {int maxOutputSize}) — Decompresses complete, concatenated, or unknown-size zstd frames with a bounded output (256 MiB by default). Invalid, truncated, or oversized input returns null.
  • getPlatformVersion() — Returns a platform identifier string.

Architecture #

This package uses Dart FFI with the native zstd C library. Swift Package Manager statically links the shared target into the app; CocoaPods remains supported and embeds the plugin framework. Both paths compile the same common/compress/decompress source set from zstandard_native. Public work runs in an isolate using Dart-owned bytes and bounded streaming decompression. Both x64 and arm64 are supported.

Testing #

From the package directory:

flutter test

Unit tests that use the native library require the framework to be built (e.g. by building the example macOS app first). Tests are skipped when not running on macOS.

Troubleshooting #

  • Swift Package Manager: Flutter 3.44 and newer enables this path by default.
  • CocoaPods: For older Flutter projects or explicit compatibility testing, run flutter config --no-enable-swift-package-manager and then pod install in your app’s macos/ directory.
  • Library not loaded: Build your app with flutter build macos or run from the macOS runner so the native target is linked. SwiftPM exposes it through the process; CocoaPods embeds the plugin framework.
  • Wrong architecture: Ensure you are building for the correct target (x64 vs arm64).

See the documentation for more.

1
likes
0
points
37.2k
downloads

Publisher

verified publishervyp.dev

Weekly Downloads

macOS implementation of the Zstandard compression plugin for Flutter applications.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

ffi, flutter, zstandard_native, zstandard_platform_interface

More

Packages that depend on zstandard_macos

Packages that implement zstandard_macos