-
Notifications
You must be signed in to change notification settings - Fork 29.1k
Closed
Description
I am developing an app with Flutter that takes an image and allows the user to save it in the gallery.
I am using image_picker_saver plugin to save it.
In the beginning I was calling the method to save the image in the main thread but I realized that was really slow and now I am trying to put it in a new isolated thread, but I am getting the same error all the time.
Run flutter doctor -v
[✓] Flutter (Channel beta, v1.0.0, on Linux, locale es_ES.UTF-8)
• Flutter version 1.0.0 at /home/nadia/flutter
• Framework revision 5391447fae (hace 6 semanas), 2018-11-29 19:41:26 -0800
• Engine revision 7375a0f414
• Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
• Android SDK at /home/nadia/Android/Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /opt/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
• All Android licenses accepted.
[✓] Android Studio (version 3.2)
• Android Studio at /opt/android-studio
• Flutter plugin version 31.3.1
• Dart plugin version 181.5656
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
[✓] VS Code (version 1.30.2)
• VS Code at /usr/share/code
• Flutter extension version 2.21.1
[✓] Connected device (1 available)
• NX591J • d2ab515a • android-arm64 • Android 7.1.2 (API 25)
This is my pubsec.yaml
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
image_picker: ^0.4.10
path_provider: ^0.4.1
path: any
image_picker_saver: ^0.1.0
uuid: ^1.0.3
simple_permissions: ^0.1.8
image: ^2.0.4
photo_view: ^0.0.10
fluttertoast: ^2.2.3
My code looks like this:
main.dart
class _AkkaMark extends State<CameraUpload>{
.
.
.
void _clickSaveImage() {
compute(saveImage, _imageFile).then((Future<String> futurePath) {
futurePath.then((String path){
_imageFile = new File(path);
});
});
}
.
.
.
}
toCompute.dart
Future<String> saveImage(File image) async {
return await ImagePickerSaver.saveFile(fileData: image.readAsBytesSync());
}
I tried to change the code trying to locate the error but is always the same:
E/flutter (22602): [ERROR:flutter/runtime/dart_isolate.cc(717)] Isolate (413787440) 'main.dart:_spawn()' exited with an error
E/flutter (22602): [ERROR:flutter/shell/common/shell.cc(184)] Dart Error: Unhandled exception:
E/flutter (22602): error: native function 'Window_sendPlatformMessage' (4 arguments) cannot be found
E/flutter (22602): #0 Window.sendPlatformMessage (dart:ui/window.dart:811:9)
E/flutter (22602): #1 BinaryMessages._sendPlatformMessage (package:flutter/src/services/platform_messages.dart:40:15)
E/flutter (22602): #2 BinaryMessages.send (package:flutter/src/services/platform_messages.dart:88:12)
E/flutter (22602): #3 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:286:49)
E/flutter (22602): <asynchronous suspension>
E/flutter (22602): #4 ImagePickerSaver.saveFile (package:image_picker_saver/image_picker_saver.dart:77:38)
E/flutter (22602): <asynchronous suspension>
E/flutter (22602): #5 saveImage (package:AKKAmark/toCompute.dart:113:35)
E/flutter (22602): <asynchronous suspension>
E/flutter (22602): #6 _IsolateConfiguration.apply (package:flutter/src/foundation/isolates.dart:88:16)
E/flutter (22602): #7 _spawn.<anonymous closure> (package:flutter/src/foundation/isolates.dart:96:30)
E/flutter (22602): #8 Timeline.timeSync (dart:developer/timeline.dart:168:22)
E/flutter (22602): #9 _spawn (package:flutter/src/foundation/isolates.dart:93:12)
E/flutter (22602): #10 _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:292:17)
E/flutter (22602): #11 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
I am not sure if it is a flutter bug or maybe the problem is with the plugin... Someone has any clue?
Thanks in advance!
spiderion
Metadata
Metadata
Assignees
Labels
No labels