Open Zazo032 opened 1 year ago
Using latest version of the repo:
camerawesome:
git:
url: https://github.com/Apparence-io/camera_awesome.git
Using Flutter version 3.3.10
.
Using CameraAwesomeBuilder.custom
:
CameraAwesomeBuilder.custom(
enableAudio: false,
saveConfig: SaveConfig.photo(
pathBuilder: () => photoPath,
),
builder: (CameraState state) {
return IconButton(
color: Colors.white,
icon: Icon(_getFlashIcon(state.sensorConfig.flashMode)),
key: const Key('flash_icon'),
onPressed: state.sensorConfig.switchCameraFlash,
);
}
),
This error appears because you are using an old sensorConfig which has been disposed internally. You should use the stream version (sensorConfig$) as explained in #172. However, I am not sure we should let things in this current state since they might not be easy to understand for newcomers.
I see two possible ways of dealing with this:
What do you think @g-apparence ?
Interesting.
I would go for solution 2. Making the getter nullable and returning value only if stream is not disposed.
@Zazo032 I would go for StreamBuilder in your case. Would be way easier to refresh the current icon.
Steps to Reproduce
Call
state.sensorConfig.switchCameraFlash
Expected results
FlashMode
iterates to the next oneActual results
About your device