encode static method

Uint8List encode(
  1. Uint8List bytes, {
  2. int level = defaultLevel,
})

Encodes bytes with GZip at level (-1 to 9).

Implementation

static Uint8List encode(Uint8List bytes, {int level = defaultLevel}) {
  var encoded = ZLibEncoder(gzip: true, level: level).convert(bytes);
  return encoded is Uint8List ? encoded : Uint8List.fromList(encoded);
}