initCameras method

Future<void> initCameras()

Initialize camera

Implementation

Future<void> initCameras() async {
  final List<CameraDescription> cameras = await availableCameras();
  cameraController = CameraController(
    cameras.first,
    ResolutionPreset.medium,
    enableAudio: enableAudio,
  );
  unawaited(cameraController.setFlashMode(FlashMode.off));

  try {
    await cameraController.initialize().then((_) {
      isPreviewCameraReady.value = true;
    });
  } catch (_) {
    isPreviewCameraReady.value = false;
  }
}