.then((_) => _cameraController = null));

This commit is contained in:
Vadim 2023-05-21 11:43:07 +02:00
parent 94f9bc9d96
commit 33f8d72815

View file

@ -60,7 +60,7 @@ class CameraContainerBloc extends EvSourceBlocBase<CameraContainerEvent, CameraC
@override @override
Future<void> close() async { Future<void> close() async {
WidgetsBinding.instance.removeObserver(_observer); WidgetsBinding.instance.removeObserver(_observer);
unawaited(_cameraController?.dispose()); unawaited(_cameraController?.dispose().then((_) => _cameraController = null));
communicationBloc.add(communication_event.MeteringEndedEvent(_ev100)); communicationBloc.add(communication_event.MeteringEndedEvent(_ev100));
return super.close(); return super.close();
} }
@ -151,7 +151,7 @@ class CameraContainerBloc extends EvSourceBlocBase<CameraContainerEvent, CameraC
Future<void> _onDeinitialize(DeinitializeEvent _, Emitter emit) async { Future<void> _onDeinitialize(DeinitializeEvent _, Emitter emit) async {
emit(const CameraLoadingState()); emit(const CameraLoadingState());
unawaited(_cameraController?.dispose()); unawaited(_cameraController?.dispose().then((_) => _cameraController = null));
} }
Future<void> _onZoomChanged(ZoomChangedEvent event, Emitter emit) async { Future<void> _onZoomChanged(ZoomChangedEvent event, Emitter emit) async {