setFlashMode method

Future<bool> setFlashMode(
  1. FlashMode mode,
  2. void setState(
    1. void ()
    )
)

Implementation

Future<bool> setFlashMode(FlashMode mode, void Function(void Function()) setState) async {
  if (widget.photoController == null) {
    return false;
  }

  try {
    await widget.photoController!.setFlashMode(mode);
    if (widget.photoController!.value.flashMode == FlashMode.off) {
      setState(() {});
      return false;
    } else {
      setState(() {});
      return true;
    }
  } on CameraException catch (e) {
    _showCameraException(e);
    rethrow;
  }
}