resetTimer method

Future resetTimer({
  1. required TimerData timerData,
  2. int? numSeconds,
  3. bool forceStart = false,
})

Implementation

Future resetTimer({
  required TimerData timerData,
  int? numSeconds,
  bool forceStart = false,
}) async {
  if (numSeconds != null) {
    timerData.numSeconds = numSeconds;
  }
  await setPersistentValue<String>(
    timerData.keyName,
    null,
  );
  if (timerData.autostart || forceStart) {
    await tryActivateTimer(timerData);
  } else {
    timerData.clearTimer();
  }
  rebuild();
}