switchCameraFlash method

void switchCameraFlash()

Switch the flash according to the previous state

Implementation

void switchCameraFlash() {
  final FlashMode newFlashMode;
  switch (flashMode) {
    case FlashMode.none:
      newFlashMode = FlashMode.auto;
      break;
    case FlashMode.on:
      newFlashMode = FlashMode.always;
      break;
    case FlashMode.auto:
      newFlashMode = FlashMode.on;
      break;
    case FlashMode.always:
      newFlashMode = FlashMode.none;
      break;
  }
  setFlashMode(newFlashMode);
}