enableTorch static method
Enables the device torch.
Throws an EnableTorchExistentUserException if the camera is being used by another user. Throws an EnableTorchNotAvailableException if a torch was not detected. Throws an EnableTorchException if the process encounters an error.
Implementation
static Future<void> enableTorch() async {
try {
await _channel.invokeMethod(_nativeEventEnableTorch);
} on PlatformException catch (e) {
switch (e.code) {
case _errorEnableTorchExistentUser:
throw EnableTorchExistentUserException(message: e.message);
case _errorEnableTorchNotAvailable:
throw EnableTorchNotAvailableException(message: e.message);
default:
throw EnableTorchException(message: e.message);
}
}
}