utils/utils library
Enums
- UniqueCompressionMethod
- Enum representing different compression methods for unique integer lists
Functions
-
getStringSize(
String text) → int - Calculates the size in bytes of a string when encoded as UTF-8.
-
restoreBytes(
Uint8List bytes) → Uint8List - Decompresses a Uint8List that was compressed by shrinkBytes.
-
restoreJson(
Uint8List compressed) → Map< String, dynamic> - Decompresses and parses JSON data that was compressed using shrinkJson.
-
restoreText(
Uint8List shrunken) → String - Decompresses a Uint8List that was compressed using shrinkText.
-
restoreUnique(
Uint8List compressed) → List< int> - Decompresses a Uint8List created by shrinkUnique back to a list of integers.
-
shrinkBytes(
Uint8List bytes) → Uint8List - Compresses a Uint8List using the optimal compression method. Returns a Uint8List with a method byte prefix followed by compressed data. Compression is lossless and can be reversed with restoreBytes().
-
shrinkJson(
Map< String, dynamic> data) → Uint8List - Compresses a JSON object to a compact binary representation.
-
shrinkText(
String text) → Uint8List - Compresses a string using UTF-8 encoding and zlib compression.
-
shrinkUnique(
List< int> ids) → Uint8List - Compresses a list of unique integers using the most efficient method.
-
shrinkUniqueManual(
List< int> ids, UniqueCompressionMethod method) → Uint8List - Compresses a list of unique integers using a specified method.