disableTorch static method

Future<void> disableTorch()

Disables the device torch.

Throws a DisableTorchExistentUserException if the camera is being used by another user. Throws a DisableTorchNotAvailableException if a torch was not detected. Throws a DisableTorchException if the process encounters an error.

Implementation

static Future<void> disableTorch() async {
  try {
    await _channel.invokeMethod(_nativeEventDisableTorch);
  } on PlatformException catch (e) {
    switch (e.code) {
      case _errorDisableTorchExistentUser:
        throw DisableTorchExistentUserException(message: e.message);
      case _errorDIsableTorchNotAvailable:
        throw DisableTorchNotAvailableException(message: e.message);
      default:
        throw DisableTorchException(message: e.message);
    }
  }
}