refactor: Fix code
This commit is contained in:
parent
7f9c21af0f
commit
18ec311863
|
|
@ -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),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -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.',
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue