Shrink class abstract

A utility class for compressing different types of data.

This class provides static methods to compress various data types:

  • bytes: Compresses raw binary data using identity or ZLIB compression and selects the best result
  • json: Compresses JSON objects efficiently
  • text: Compresses strings using UTF-8 encoding and zlib
  • unique: Compresses lists of unique integers using specialized algorithms

Example:

// Compress a string
final compressed = Shrink.text('Hello world!');

// Compress a JSON object
final jsonCompressed = Shrink.json({'name': 'John', 'age': 30});

Constructors

Shrink.new()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

bytes(Uint8List bytes) Uint8List
Compresses a Uint8List using zlib compression or no compression (identity).
json(Map<String, dynamic> json) Uint8List
Compresses a JSON object using efficient encoding.
text(String text) Uint8List
Compresses a string using UTF-8 encoding and zlib compression.
unique(List<int> uniqueList) Uint8List
Compresses a list of unique integers using the most efficient algorithm.
uniqueManual(List<int> uniqueList, UniqueCompressionMethod method) Uint8List
Compresses a list of unique integers using a specified compression method.