shrinkBytes function

Uint8List shrinkBytes(
  1. Uint8List bytes
)

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().

Implementation

Uint8List shrinkBytes(Uint8List bytes) {
  final _BestCompressionResult best = _tryZlibCompression(bytes);
  return _buildFinalResult(best.method, best.data);
}