Closed rignaneseleo closed 2 months ago
2.3.0
Android
Pixel API 34
[✓] Flutter (Channel stable, 3.22.0, on macOS 14.4.1 23E224 darwin-arm64, locale en-US) • Flutter version 3.22.0 on channel stable at /Users/leonardorignanese/fvm/versions/3.22.0 • Upstream repository https://github.com/flutter/flutter.git • Framework revision 5dcb86f68f (13 days ago), 2024-05-09 07:39:20 -0500 • Engine revision f6344b75dc • Dart version 3.4.0 • DevTools version 2.34.3 [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/leonardorignanese/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160) • All Android licenses accepted.
Create the function:
Future<Uint8List> getCompressedPhotoIsolate(Uint8List originalData) async { FlutterImageCompress.ignoreCheckSupportPlatform(true); return await FlutterImageCompress.compressWithList( originalData, minWidth: 1920, minHeight: 1920, quality: 94, autoCorrectionAngle: true, keepExif: true, //TODO use rotate to get the correct orientation ); }
And then call the following from inside a class:
final compressedFileBytes = await compute(getCompressedPhotoIsolate, originalData);
E/BF/Bugfender( 6866): Reported crash with Title: UnimplementedError and Message: #0 UnsupportedFlutterImageCompress.ignoreCheckSupportPlatform (package:flutter_image_compress_platform_interface/flutter_image_compress_platform_interface.dart:139:5) E/BF/Bugfender( 6866): #1 FlutterImageCompress.ignoreCheckSupportPlatform (package:flutter_image_compress/flutter_image_compress.dart:144:15) E/BF/Bugfender( 6866): #2 getCompressedPhotoIsolate (package:onda/view/ph/pages/upload_page/controller/file_upload_controller.dart:301:24) E/BF/Bugfender( 6866): #3 compute.<anonymous closure> (package:flutter/src/foundation/_isolates_io.dart:19:20) E/BF/Bugfender( 6866): #4 _RemoteRunner._run (dart:isolate:1090:47) E/BF/Bugfender( 6866): #5 _RemoteRunner._remoteExecute (dart:isolate:1084:12) E/BF/Bugfender( 6866): #6 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:300:17) E/BF/Bugfender( 6866): #7 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
No response
@leorigna
I solved the issue using this approach: https://medium.com/@varmavetukuri1234/image-picker-using-dart-isolate-f9451c024e1d
Version
2.3.0
Platforms
Android
Device Model
Pixel API 34
flutter info
How to reproduce?
Create the function:
And then call the following from inside a class:
Logs
Example code (optional)
No response
Contact
@leorigna