refactor: Fix code

This commit is contained in:
Koji Wakamiya 2025-12-10 22:08:42 +09:00
parent 7f9c21af0f
commit 18ec311863
No known key found for this signature in database
2 changed files with 4 additions and 3 deletions

View File

@ -64,9 +64,9 @@ class ImageConverter {
OutputFormat format = OutputFormat.jpeg, OutputFormat format = OutputFormat.jpeg,
int quality = 100, int quality = 100,
bool runInIsolate = true, bool runInIsolate = true,
}) { }) async {
if (runInIsolate) { if (runInIsolate) {
return compute( return await compute(
_convertInIsolate, _convertInIsolate,
_ConvertRequest(inputData, format, quality, defaultTargetPlatform), _ConvertRequest(inputData, format, quality, defaultTargetPlatform),
); );

View File

@ -51,7 +51,8 @@ final class ImageConverterAndroid implements ImageConverterPlatform {
compressFormat = switch (format) { compressFormat = switch (format) {
OutputFormat.jpeg => Bitmap$CompressFormat.JPEG, OutputFormat.jpeg => Bitmap$CompressFormat.JPEG,
OutputFormat.png => Bitmap$CompressFormat.PNG, OutputFormat.png => Bitmap$CompressFormat.PNG,
OutputFormat.webp => Bitmap$CompressFormat.WEBP_LOSSY, // TODO: WebP is deprecated since Android 10, consider using WebP_LOSSY or WebP_LOSSLESS
OutputFormat.webp => Bitmap$CompressFormat.WEBP,
OutputFormat.heic => throw UnsupportedError( OutputFormat.heic => throw UnsupportedError(
'HEIC output format is not supported on Android.', 'HEIC output format is not supported on Android.',
), ),