'Flutter: (stop_watch_timer) problem Timer reset when reopen the screen
I'm trying to make the timer a value that keeps changing Every time I close the page and reopen it, the old one is deleted.
final _isHours = true;
int minuts0 = 5 ;
final StopWatchTimer _stopWatchTimer = StopWatchTimer(
mode: StopWatchMode.countDown,
presetMillisecond: StopWatchTimer.getMilliSecFromHour(1),
);
var IndexedStackSelected = 0;
@override
void initState() {
super.initState();
_stopWatchTimer.minuteTime.listen((value) => minuts0 = value);
/// Can be set preset time. This case is "00:01.23".
// _stopWatchTimer.setPresetTime(mSec: 1234);
}

There is another thing that I created the Add Minutes button to add 30 minutes when pressed But every time it is pressed, it does a strange arithmetic operation For example, if the timer is 30:00 and you press the Add minutes button, the new timer will be 1:00:00 The problem is that if the minutes are less than 30 minutes, for example, 28 minutes, it is treated as 30 minutes and not 28 minutes, and when you press the add button, the result will be 1:00:00 as well. iam using this code
onPressed: (){
_stopWatchTimer.setPresetMinuteTime(30);
},
source that iam using : https://pub.dev/packages/stop_watch_timer
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
