I am taking an image from the camera and just showing it in a widget in xFile format but the issue is it's flipping the image.
I am using camera: ^0.9.4+5
void onTakePictureButtonPressed() {
takePicture().then((XFile? file) {
if (mounted) {
setState(() {
imageFile = file;
});
if (file != null) {
print('Picture saved to ${file.path}');
filePath = file.path;
setState(() {
retake = true;
});
}
}
});
}
Future<XFile?> takePicture() async {
final CameraController? cameraController = _controller;
if (cameraController == null || !cameraController.value.isInitialized) {
print('Error: select a camera first.');
return null;
}
if (cameraController.value.isTakingPicture) {
// A capture is already pending, do nothing.
return null;
}
try {
XFile file = await cameraController.takePicture();
return file;
} on CameraException catch (e) {
_showCameraException(e);
return null;
}
}
Maybe I can show it by just rotating my image widget but it will save and flip images in my Database.