encode static method

Uint8List? encode(
  1. Uint8List bytes, {
  2. int quality = defaultQuality,
})

Encodes bytes with Brotli at quality (0 to 11).

Returns null if the encoder fails (the error is logged), so the caller can fall back to another encoding.

Implementation

static Uint8List? encode(Uint8List bytes, {int quality = defaultQuality}) {
  try {
    return encoder(bytes, quality.clamp(0, 11));
  } catch (e, s) {
    _logEncodeError(bytes.length, quality, e, s);
    return null;
  }
}