takePicture method
Implementation
Future<File?> takePicture() async {
if (cameraController == null) {
log("unable to takePicture, cameraController missing");
return null;
}
final xFile = await cameraController?.takePicture();
if (xFile == null) return null;
final newFile = File(xFile.path);
if (Platform.isIOS) return newFile;
final imageBytes = await xFile.readAsBytes();
final originalImage = image_lib.decodeImage(imageBytes);
if (originalImage == null) return null;
if(currentCameraLensDirection == CameraLensDirection.back) return newFile;
final fixedImage = image_lib.flipHorizontal(originalImage);
await newFile.writeAsBytes(image_lib.encodeJpg(fixedImage), flush: true);
return newFile;
}