facing property

CameraFacing get facing

Hardware camera lens facing direction (mobile_scanner API compatibility).

Implementation

CameraFacing get facing {
  if (_availableCameras.isEmpty ||
      _selectedCameraIndex >= _availableCameras.length) {
    return CameraFacing.back;
  }
  final lens = _availableCameras[_selectedCameraIndex].lensDirection;
  if (lens == cam.CameraLensDirection.front) return CameraFacing.front;
  if (lens == cam.CameraLensDirection.back) return CameraFacing.back;
  return CameraFacing.unknown;
}