Flutter Camera Plugin taking dark image bug
I think it's not about a delay, images are dark if exposure is not handled.Also exposure requires focus pre captures to work and are not handled in official plugin now.
You can use this plugin : CamerAwesome
Official plugin has been quite abandonned. This plugin includes flash, zoom, auto focus, exposure... and no initialisation required.It uses value notifier to change data directly in preview like this :
// init Notifiers ValueNotifier<CameraFlashes> _switchFlash = ValueNotifier(CameraFlashes.NONE); ValueNotifier<Sensors> _sensor = ValueNotifier(Sensors.BACK); ValueNotifier<Size> _photoSize = ValueNotifier(null); @override Widget build(BuildContext context) { return CameraAwesome( onPermissionsResult: (bool result) { } selectDefaultSize: (List<Size> availableSizes) => Size(1920, 1080), onCameraStarted: () { }, onOrientationChanged: (CameraOrientations newOrientation) { }, zoom: 0.64, sensor: _sensor, photoSize: _photoSize, switchFlashMode: _switchFlash, orientation: DeviceOrientation.portraitUp, fitted: true, ); };
Just put delay before take picture.
Future.delayed(const Duration(milliseconds: 500), () {_controller.takePicture(path);});