toggleTorch method
Toggles the torch, if available.
Implementation
Future<void> toggleTorch() async {
if (!state._togglingTorch) {
state._togglingTorch = true;
try {
state._torchState = await _platform.toggleTorch();
} catch (error, stack) {
state._error = error;
state.eventNotifier.value = CameraEvent.error;
debugPrint(error.toString());
debugPrintStack(stackTrace: stack);
}
state._togglingTorch = false;
}
}