cropImage static method
Future<FileData?>
cropImage({
- Uint8List? bytes,
- String? filePath,
- UCropOptions options = const UCropOptions(),
- dynamic action(
- FileData file
Implementation
static Future<FileData?> cropImage({
Uint8List? bytes,
String? filePath,
UCropOptions options = const UCropOptions(),
Function(FileData file)? action,
}) async {
Uint8List? data = bytes;
if (data == null && filePath != null && !kIsWeb) data = await File(filePath).readAsBytes();
if (data == null) return null;
final FileData? cropped = await _openCropper(data, options);
if (cropped == null) return null;
action?.call(cropped);
return cropped;
}