decodeContent function
Decodes bytes encoded with encoding.
Implementation
Uint8List decodeContent(
Uint8List bytes,
APIContentEncoding encoding, {
int? maxOutputSize,
}) {
switch (encoding) {
case APIContentEncoding.br:
return APIBrotli.decode(bytes, maxOutputSize: maxOutputSize);
case APIContentEncoding.gzip:
var decoded = gzip.decode(bytes);
return decoded is Uint8List ? decoded : Uint8List.fromList(decoded);
}
}