fluttercandies / flutter_image_editor

Flutter plugin, support android/ios.Support crop, flip, rotate, color martix, mix image, add text. merge multi images.
Apache License 2.0
421 stars 129 forks source link

Major error occurs when trying to access the rawImageData #62

Closed Letalus closed 3 years ago

Letalus commented 3 years ago

There is following issue. As a default within the ExtendedImage.file the cropAspectRatio is ratio9_16. (screenshot 1) Screenshot 2021-04-19 at 10 05 14

When the user switches to the ratio CropAspectRatios.original everything works fine (see screenshot 2) Screenshot 2021-04-19 at 10 04 43

Now when I try to crop the image to the 9_16 format I run the cropImageDataWithNativeLibrary. This now throws me following error: Unhandled Exception: 'package:extended_image_library/src/extended_image_provider.dart': Failed assertion: line 38 pos 7: 'rawImageDataMap.containsKey(this)': raw image data is not already now! and stack: #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:46:39)

Entire error stack: flutter: native library start cropping [ +7 ms] [VERBOSE-2:ui_dart_state.cc(186)] Unhandled Exception: 'package:extended_image_library/src/extended_image_provider.dart': Failed assertion: line 38 pos 7: 'rawImageDataMap.containsKey(this)': raw image data is not already now! and stack: #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:46:39) [ ] #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5) [ ] #2 ExtendedImageProvider.rawImageData (package:extended_image_library/src/extended_image_provider.dart:38:7) [ ] #3 ExtendedImageEditorState.rawImageData (package:extended_image/src/editor/extended_image_editor.dart:307:34) [ ] #4 ImageEditorService.cropImageDataWithNativeLibrary (package:dayblizz/core/services/ui/image_editor_service.dart:35:33) [ ] #5 SelectImageProvider._cropImage (package:dayblizz/core/viewmodels/upload/select_Image_Provider.dart:311:12) [ ] #6 SelectImageProvider._replaceSelectedImageWithCroppedImage (package:dayblizz/core/viewmodels/upload/select_Image_Provider.dart:281:35) [ ] #7 SelectImageProvider.navigateToNextScreen (package:dayblizz/core/viewmodels/upload/select_Image_Provider.dart:347:11) [ ] #8 SelectImageScreen.build.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:dayblizz/ui/screens/Upload/select_Image_Screen.dart:104:50) [ ] #9 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24) [ ] #10 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:607:11) [ ] #11 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:296:5) [ ] #12 BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:267:7) [ ] #13 GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:157:27) [ ] #14 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:385:20) [ ] #15 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:361:22) [ ] #16 RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:278:11) [ ] #17 GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:316:7) [ ] #18 GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:280:5) [ ] #19 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:238:7) [ ] #20 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:221:7) [ ] #21 _rootRunUnary (dart:async/zone.dart:1370:13) [ ] #22 _CustomZone.runUnary (dart:async/zone.dart:1265:19) [ ] #23 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7) [ ] #24 _invoke1 (dart:ui/hooks.dart:180:10) [ ] #25 PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:276:7) [ ] #26 _dispatchPointerDataPacket (dart:ui/hooks.dart:96:31) [ ] #0 SelectImageProvider._cropImage (package:dayblizz/core/viewmodels/upload/select_Image_Provider.dart:315:7) [ ] <asynchronous suspension> [ ] #1 SelectImageProvider._replaceSelectedImageWithCroppedImage (package:dayblizz/core/viewmodels/upload/select_Image_Provider.dart:281:29) [ ] <asynchronous suspension> [ ] #2 SelectImageProvider.navigateToNextScreen (package:dayblizz/core/viewmodels/upload/select_Image_Provider.dart:347:5) [ ] <asynchronous suspension>

Screenshot 2021-04-19 at 10 06 49

Error occuring screenshot: Screenshot 2021-04-19 at 10 22 09

Funny fact, if I don't change the aspect Ratio of the image there is of course no cropping and therefore there is also no error.

My question now is, what does this error mean ( 'rawImageDataMap.containsKey(this)': raw image data is not already now! and stack)? This error occured since this cache mechnism has been included.

CaiJingLong commented 3 years ago

Hi, this is not the scope of this library, you can go to extended_image to ask questions.

Letalus commented 3 years ago

oh okay thanks for the quick answer. Will close this issue here