setTorchMode method

Future<void> setTorchMode(
  1. int mode
)

Sets the current torch mode.

Setting the value of this method also sets the torch level to its maximum current value.

Before setting the value of this property, call the torchModesSupported method to make sure the device supports the desired mode. Setting the device to an unsupported torch mode results in the raising of an exception. For a list of possible values for this property, see CaptureTorchMode.

Before changing the value of this property, you must call lockForConfiguration to acquire exclusive access to the device’s configuration properties. Otherwise, setting the value of this property raises an exception. When you finish configuring the device, call unlockForConfiguration to release the lock and allow other devices to configure the settings.

Implementation

Future<void> setTorchMode(int mode) {
  return _channel.$setTorchMode(this, mode);
}