79360761

Date: 2025-01-16 08:05:02
Score: 0.5
Natty:
Report link

Yeah it was resolved! I just did some changes in demo_page.dart to call the function from there.

This logic solved the bug.

// Calculate the incremental duration since the last save
int currentTimerValue = provider.timerValue.toInt();
int incrementalDuration = currentTimerValue - provider.lastSavedTime;

// Save the incremental duration if it's valid
if (incrementalDuration > 0) {
  provider.addFocusSession(Duration(seconds: incrementalDuration),
      isCompleted: true, taskType: selectedItem);
  provider.lastSavedTime = currentTimerValue; // Update the last saved time
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Kusal Darshana