convert method

  1. @override
Future<bool> convert(
  1. String inputPath,
  2. String outputPath, {
  3. int compressionLevel = 6,
  4. bool preserveMetadata = true,
})
override

Converts a HEIC/HEIF file at inputPath to PNG at outputPath.

Implementation

@override
Future<bool> convert(
  String inputPath,
  String outputPath, {
  int compressionLevel = 6,
  bool preserveMetadata = true,
}) async {
  final result = await methodChannel.invokeMethod<bool>('convert', {
    'inputPath': inputPath,
    'outputPath': outputPath,
    'compressionLevel': compressionLevel.clamp(0, 9),
    'preserveMetadata': preserveMetadata,
  });
  if (result == null) {
    throw PlatformException(
      code: 'conversion_failed',
      message: 'Platform returned null result',
    );
  }
  return result;
}