editImageAndGetFile method
Future<File>
editImageAndGetFile({
- required Uint8List image,
- required ImageEditorOption imageEditorOption,
The image
is the source of image.
The imageEditorOption
is the option for edit image.
The method will return a File as image result.
If result is null, it means handle image error.
Implementation
@override
Future<File> editImageAndGetFile({
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);
}
final file = File(await _createTmpFilePath());
if (tmp != null) {
await file.writeAsBytes(tmp);
}
return file;
}