shrink
1.5.12, released a year ago by jozz.biz
Compresses data to 5x‑40x smaller size with lossless restoration
What it does
Shrink automatically detects the best compression method for a given String, Map, Uint8List or List<int> and returns a compact representation. The original data can be restored exactly with a single method call.
AI-written summary of version 1.5.12, based on the package's README and metadata. Report an inaccuracy
Use it when
- Reducing Firebase payloads
- Storing large JSON or text locally
- Optimizing low‑bandwidth network traffic
Skip it when
- Compressing data that is already compressed or random
- Using it on binary media that is already lossless
Strengths
- Zero‑setup, one‑line API
- Lossless and fully backward compatible
- Automatic method selection and performance optimizations
Weaknesses
- Adds a byte if data is compressed twice
- Not effective on truly random data
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
final compressed = data.shrink();
final restored = compressed.restoreJson();Alternatives
Packages that do the same job and could replace shrink.
- json_schema
Validate JSON data against JSON Schema drafts in Dart.
63Compare - conduit_codable
A library for encoding and decoding dynamic structured data like JSON and YAML into Dart objects.
66Compare - gzip
A lightweight package for gzip compression and decompression.
50Compare - g_json
Convenient JSON access and manipulation with optional getters and setters
46Compare
Works with
Packages commonly used together with shrink: ones it builds on, ones built on it, and its own family.