Compression constructor

Compression({
  1. int level = 6,
  2. int asyncThreshold = 50000,
})

Creates a new instance of Compression.

The level parameter can be used to set the compression level. Values range from 1 (fastest, least compression) to 9 (slowest, most compression). The default value is 6, which provides a good balance between speed and compression ratio.

The asyncThreshold parameter determines the string size (in characters) above which compression will be performed in a separate isolate to avoid blocking the main thread. The default value is 50000 characters.

Implementation

Compression({int level = 6, int asyncThreshold = 50000})
    : _level = level.clamp(1, 9),
      _asyncThreshold = asyncThreshold;