ImageCompressorOptions constructor

const ImageCompressorOptions({
  1. required int targetSizeInKB,
  2. int initialQuality = 92,
  3. int minQuality = 40,
  4. int step = 4,
  5. int? maxWidth,
  6. int? maxHeight,
  7. CompressFormat format = CompressFormat.jpeg,
  8. bool keepExif = false,
  9. double earlyStopRatio = 0.95,
  10. double nearTargetFactor = 1.2,
  11. int preferredMinQuality = 80,
  12. int maxAttemptsPerDim = 5,
  13. int maxTotalTrials = 24,
})

Implementation

const ImageCompressorOptions({
  required this.targetSizeInKB,
  this.initialQuality = 92,
  this.minQuality = 40,
  this.step = 4,
  this.maxWidth,
  this.maxHeight,
  this.format = CompressFormat.jpeg,
  this.keepExif = false,
  this.earlyStopRatio = 0.95,
  this.nearTargetFactor = 1.2,
  this.preferredMinQuality = 80,
  this.maxAttemptsPerDim = 5,
  this.maxTotalTrials = 24,
})  : assert(targetSizeInKB > 0),
      assert(initialQuality <= 100 && initialQuality > 0),
      assert(minQuality > 0 && minQuality <= initialQuality),
      assert(step > 0),
      assert(earlyStopRatio > 0 && earlyStopRatio <= 1.0),
      assert(nearTargetFactor >= 1.0),
      assert(preferredMinQuality > 0 && preferredMinQuality <= 100),
      assert(maxAttemptsPerDim > 0),
      assert(maxTotalTrials > 0);