takePicture method
Implementation
Future<XFile?> takePicture() async {
final CameraController cameraController = controller!;
if (cameraController == null || !cameraController.value.isInitialized) {
showInSnackBar('Error: select a camera first.');
return null;
}
if (cameraController.value.isTakingPicture) {
// A capture is already pending, do nothing.
return null;
}
try {
final XFile? file = await cameraController.takePicture();
print("photo start");
if (file == null){
print("photo is null");
return null;
}
print("photo is ${file.path}");
return file;
} on CameraException catch (e) {
// _showCameraException(e);
return null;
}
}