decodeAsync static method
Same as decode, but decodes in the compressionIsolatePool (a
background Isolate), for untrusted input: its decoded size can't be
known from its length (a few bytes can decode to maxOutputSize).
Throws the same BrotliException as decode.
Implementation
static Future<Uint8List> decodeAsync(Uint8List bytes, {int? maxOutputSize}) {
final limit = maxOutputSize ?? brotliDefaultMaxOutputSize;
return compressionIsolatePool
.run(() => _decodeInIsolate(bytes, limit))
.then((result) {
var (decoded, code, message, inputOffset) = result;
if (decoded != null) return decoded;
throw BrotliException(
BrotliErrorCode.values.byName(code!),
message ?? '',
inputOffset: inputOffset,
);
});
}