startTimer method

void startTimer()

Implementation

void startTimer() {
  timer?.cancel(); // Cancel any existing timer
  timer = Timer.periodic(const Duration(seconds: 1), (timer) {
    if (totalSecond > 0) {
      totalSecond--;
      notifyListeners();
    } else {
      timer.cancel();
      notifyListeners();
      onFinished?.call();
    }
  });
}