startResendTimer method

void startResendTimer()

Start/restart the resend countdown timer

Implementation

void startResendTimer() {
  _timer?.cancel();
  resendCountdown.add(_config.resendCooldown.inSeconds);
  _timer = Timer.periodic(const Duration(seconds: 1), (timer) {
    final remaining = resendCountdown.value - 1;
    if (remaining <= 0) {
      resendCountdown.add(0);
      timer.cancel();
    } else {
      resendCountdown.add(remaining);
    }
  });
}