startStoreTimer method

Future<void> startStoreTimer(
  1. int sec
)

Implementation

Future<void> startStoreTimer(int sec) async {
  try {
    secondsRemainingStore.value = sec;
    timerStore != null && timerStore!.isActive ? timerStore?.cancel() : null;
    timerStore = Timer.periodic(const Duration(seconds: 1), (_) {
      if (secondsRemainingStore.value != 0) {
        secondsRemainingStore.value--;
        print("objectTimer   2    ${secondsRemainingStore.value}");
      } else {
        isResend.value = true;
        timerStore?.cancel();
      }
    });
  } catch (e) {
    // Handle network errors
  }
}