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