updateTimer method

void updateTimer({
  1. required int totalSeconds,
})

Implementation

void updateTimer({required int totalSeconds}) {
  int second = totalSeconds % 60;
  int minute = (totalSeconds ~/ 60) % 60;
  int hour = totalSeconds ~/ 3600;

  if (hour > 0) {
    timerText.value =
        "${hour.toString().padLeft(2, '0')}:${minute.toString().padLeft(2, '0')}:${second.toString().padLeft(2, '0')}";
  } else {
    timerText.value =
        "${minute.toString().padLeft(2, '0')}:${second.toString().padLeft(2, '0')}";
  }
}