compressWithList static method

Future<Uint8List> compressWithList(
  1. Uint8List image, {
  2. int minWidth = 1920,
  3. int minHeight = 1080,
  4. int quality = 95,
  5. int rotate = 0,
  6. int inSampleSize = 1,
  7. bool autoCorrectionAngle = true,
  8. CompressFormat format = CompressFormat.jpeg,
  9. bool keepExif = false,
})

Compress image from Uint8List to Uint8List.

Implementation

static Future<Uint8List> compressWithList(
  Uint8List image, {
  int minWidth = 1920,
  int minHeight = 1080,
  int quality = 95,
  int rotate = 0,
  int inSampleSize = 1,
  bool autoCorrectionAngle = true,
  CompressFormat format = CompressFormat.jpeg,
  bool keepExif = false,
}) async {
  if (image.isEmpty) {
    throw "The image is empty.";
  }

  final support = await _validator.checkSupportPlatform(format);
  if (!support) {
    throw "The image is not support.";
  }

  final result = await _channel.invokeMethod("compressWithList", [
    image,
    minWidth,
    minHeight,
    quality,
    rotate,
    autoCorrectionAngle,
    _convertTypeToInt(format),
    keepExif,
    inSampleSize,
  ]);

  return result;
}