takePhoto method
- {bool addCrop = false}
addCrop: true 拍照加裁剪, 直接返回裁剪后的路径 addCrop: false 单纯拍照,返回 AssetEntity
Implementation
Future<dynamic> takePhoto({bool addCrop = false}) async {
if (!await checkCameraPermission()) return null;
try {
var result =
await _channel.invokeMethod('takePhoto', addCrop ? takePhotoAddCrop : takePhotoSingle);
if (result is String) {
return result;
} else if (result is Map) {
return AssetEntity.fromJson(Map<String, dynamic>.from(result));
}
} catch (e) {}
return null;
}