Is there a general way to do this?
To add more context, it seems the camera plugin takes into account the device orientation when capturing image from the camera. Can we control it so that no matter what the orientation is, the result is still the same?
plugin: camera 0.4.0+3
To app-wide change/lock device orientation to portrait/landscape only in Flutter, you can use the SystemChrome. setPreferredOrientations method and allow the list of orientations that you want to set.
You can use the takePicture() method on the camera controller to take a picture using the device camera. The captured picture is returned as a XFile (which is a cross-platform file abstraction). This function returns the captured picture as XFile if the capture is successful, otherwise it returns null .
For those who're struggling with this problem, checking your device orientation when taking photos and its resulting exif data should help. Try these libraries:
native_device_orientation
exif
flutter_exif_rotation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With