SensorConfig constructor

SensorConfig({
  1. required Sensors sensor,
  2. FlashMode flash = FlashMode.none,
  3. bool mirrorFrontCamera = false,
  4. SensorType type = SensorType.wideAngle,
  5. String? captureDeviceId,
  6. CameraAspectRatios aspectRatio = CameraAspectRatios.ratio_4_3,
  7. double currentZoom = 0.0,
})

Implementation

SensorConfig({
  required this.sensor,
  FlashMode flash = FlashMode.none,
  bool mirrorFrontCamera = false,
  SensorType type = SensorType.wideAngle,
  this.captureDeviceId,
  CameraAspectRatios aspectRatio = CameraAspectRatios.ratio_4_3,

  /// Zoom must be between 0.0 (no zoom) and 1.0 (max zoom)
  double currentZoom = 0.0,
}) {
  _flashModeController = BehaviorSubject<FlashMode>.seeded(flash);
  flashMode$ = _flashModeController.stream;

  _mirrorFrontCameraController =
      BehaviorSubject<bool>.seeded(mirrorFrontCamera);
  mirrorFrontCamera$ = _mirrorFrontCameraController.stream;

  _sensorTypeController = BehaviorSubject<SensorType>.seeded(type);
  sensorType$ = _sensorTypeController.stream;

  _zoomController = BehaviorSubject<double>.seeded(currentZoom);
  zoom$ = _zoomController.stream;

  _aspectRatioController = BehaviorSubject.seeded(aspectRatio);
  aspectRatio$ = _aspectRatioController.stream;

  _brightnessSubscription = _brightnessController.stream
      .debounceTime(const Duration(milliseconds: 500))
      .listen((value) => CamerawesomePlugin.setBrightness(value));
}