0

i am using this extended_Image to crop images from then Save the raw file to phone, get the raw data and push it to firebase storage. but i keep getting this error.

Unhandled Exception: 'package:extended_image_library/src/extended_image_provider.dart': Failed assertion: line 34 pos 12: 'cacheRawData': you should set [ExtendedImageProvider.cacheRawData] to true, if you want to get rawImageData from provider.

which i did not understand. here is my code

Future<void> crop([bool test = false]) async {
    final ExtendedImageEditorState state = editorKey.currentState;
    final Rect rect = state.getCropRect();
    final EditActionDetails action = state.editAction;
    final double radian = action.rotateAngle;

    final bool flipHorizontal = action.flipY;
    final bool flipVertical = action.flipX;
    final Uint8List img = state.rawImageData;

    final option = ImageEditorOption();

    option.addOption(ClipOption.fromRect(rect));
    option.addOption(
        FlipOption(horizontal: flipHorizontal, vertical: flipVertical));
    if (action.hasRotateAngle) {
      option.addOption(RotateOption(radian.toInt()));
    }

    option.addOption(ColorOption.saturation(sat));
    option.addOption(ColorOption.brightness(bright + 1));
    option.addOption(ColorOption.contrast(con));

    option.outputFormat = const OutputFormat.jpeg(100);

    print(const JsonEncoder.withIndent('  ').convert(option.toJson()));

    final DateTime start = DateTime.now();
    final Uint8List result = await ImageEditor.editImage(
      image: img,
      imageEditorOption: option,
    );

    print('result.length = ${result?.length}');

    final Duration diff = DateTime.now().difference(start);
    image?.writeAsBytesSync(result);
    print('image_editor time : $diff');
    //--here is the uploading url--
    final imageUrl = await uploadingFile(uploadFile: image);
    // storing the url to console
    firestore
        .collection('Image')
        .doc(auth.currentUser?.uid)
        .collection('Photos')
        .doc()
        .set({
      'picture': imageUrl,
    });
  }

1 Answer 1

-1
ExtendedExactAssetImageProvider(widget.params['path'],cacheRawData: true)
2
  • i forgot to answer this, is already solved... anyways i will mark your answer Aug 5, 2021 at 12:11
  • Please provide the solution Apr 5, 2022 at 13:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.