stopPeriodically method

Future<void> stopPeriodically()

Stops the torch flashlight from flashing periodically by canceling any existing timer.

Implementation

Future<void> stopPeriodically() async {
  try {
    _periodicTimer?.cancel();
    _periodicTimer = null;
    await TorchFlashlight.disableTorchFlashlight();
    _isEnabled = false;
  } catch (e) {
    throw Exception('Error stopping periodic toggle: $e');
  }
}