Closed annkitpanwar closed 3 years ago
I just tried it in a new project and it worked as expected.
Please share a code snippet of how you're using scannedImage.getScannedDocumentAsFile()
and the value of scannedImage.croppedImage
. You can output it using : print(scannedImage.croppedImage);
Hi, thanks for the reply.
here is my code
Future<void> _onClickScanDocument(context, ScannedImage scannedImage) async {
print("ScanDocument: ${scannedImage.toJson()}");
if (scannedImage.croppedImage != null) {
if (widget.from == VALUE_INTRO) {
_bloc.fileSink.add(scannedImage.getScannedDocumentAsFile());
} else {
Navigator.of(context).pop(scannedImage.getScannedDocumentAsFile());
}
}
}
and here is the scanned image data
I/flutter (22635): ScanDocument: {"croppedImage":"file:///data/user/0/com.possibility.algo/cache/documents/1dd202ad-0653-4dda-9b2a-b30bd646842c.jpg","width":499,"initialImage":"file:///data/user/0/com.possibility.algo/cache/documents/b1e0f7da-54b9-43e5-a2a9-05f91dd9f1e7.jpg","height":888}
The full error is below
E/AndroidRuntime(22635): FATAL EXCEPTION: Worker Thread
E/AndroidRuntime(22635): Process: com.possibility.algo, PID: 22635
E/AndroidRuntime(22635): java.lang.IllegalArgumentException: Requested path /data/data/com.possibility.algo/cache/documents/1dd202ad-0653-4dda-9b2a-b30bd646842c.jpg doesn't appear under [/storage/emulated/0]
E/AndroidRuntime(22635): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:170)
E/AndroidRuntime(22635): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:140)
E/AndroidRuntime(22635): at android.content.ContentProviderProxy.insert(ContentProviderNative.java:481)
E/AndroidRuntime(22635): at android.content.ContentResolver.insert(ContentResolver.java:1841)
E/AndroidRuntime(22635): at com.example.document_scanner.helpers.Utils.addImageToGallery(Utils.java:215)
E/AndroidRuntime(22635): at com.example.document_scanner.views.OpenNoteCameraView.saveDocument(OpenNoteCameraView.java:741)
E/AndroidRuntime(22635): at com.example.document_scanner.ImageProcessor.processPicture(ImageProcessor.java:190)
E/AndroidRuntime(22635): at com.example.document_scanner.ImageProcessor.handleMessage(ImageProcessor.java:116)
E/AndroidRuntime(22635): at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime(22635): at android.os.Looper.loop(Looper.java:224)
E/AndroidRuntime(22635): at android.os.HandlerThread.run(HandlerThread.java:67)
I/Process (22635): Sending signal. PID: 22635 SIG: 9
Please check version 0.1.2 if the problem is resolved. I can't confirm it, because the problem isn't occurring on my device.
Thanks @eliasteeny for quick support, version 0.1.2 fixed this issue.
I am using
document_scanner: ^0.1.1
. When app scan the document, and when i am usingscannedImage.getScannedDocumentAsFile()
for getting File, Its getting crash with below message.java.lang.IllegalArgumentException: Requested path /data/data/com.abc/cache/documents/cc53d53c-1ac2-405f-b1b4-b01cc53c028e.jpg doesn't appear under [/storage/emulated/0]
my
flutter doctor -v
is