editImage method

  1. @override
Future<Uint8List?> editImage({
  1. required Uint8List image,
  2. required ImageEditorOption imageEditorOption,
})

The image is a source of image.

The imageEditorOption option for edit image.

The method will return a Uint8List as image result.

If result is null, it means handle image error.

Implementation

@override
Future<Uint8List?> editImage({
  required Uint8List image,
  required ImageEditorOption imageEditorOption,
}) async {
  Uint8List? tmp = image;
  for (final group in imageEditorOption.groupList) {
    if (group.canIgnore) {
      continue;
    }
    final handler = ImageHandler.memory(tmp);
    final editOption = ImageEditorOption();
    for (final option in group) {
      editOption.addOption(option);
    }
    editOption.outputFormat = imageEditorOption.outputFormat;
    tmp = await handler.handleAndGetUint8List(editOption);
  }
  return tmp;
}