editFileImage method
Future<Uint8List?>
editFileImage({
- required File file,
- required ImageEditorOption imageEditorOption,
The file
is the source of image.
The imageEditorOption
is the 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?> editFileImage({
required File file,
required ImageEditorOption imageEditorOption,
}) async {
Uint8List? tmp;
bool isHandle = false;
for (final group in imageEditorOption.groupList) {
if (group.canIgnore) {
continue;
}
final handler = ImageHandler.file(file);
final editOption = ImageEditorOption();
for (final option in group) {
editOption.addOption(option);
}
editOption.outputFormat = imageEditorOption.outputFormat;
tmp = await handler.handleAndGetUint8List(editOption);
isHandle = true;
}
if (isHandle) {
return tmp;
} else {
return file.readAsBytesSync();
}
}