setTorchMode method
Set the torch mode for a device.
supportedTorchModes should be called before this.
For some platforms, this can override a flash mode.
Implementation
@override
Future<void> setTorchMode(TorchMode mode) {
verifyInitialized();
verifyNotDisposed();
device.device.lockForConfiguration();
switch (mode) {
case TorchMode.on:
device.device.setTorchMode(CaptureTorchMode.on);
break;
case TorchMode.off:
device.device.setTorchMode(CaptureTorchMode.off);
break;
}
return device.device.unlockForConfiguration();
}