Hi guys,
I developed a Flutter application that basically is a count down timer.
It is based on the Pomodoro Technique.
I want to report a strange behaviour of Timer.periodic() that sadly I cannot repro (hence I did not open a github issue)
In my app, I have a nice "Start" button that start's a count down. You can see below the code I use to start a timer.
I'm using this app daily for about 1 and half month. Each day I use it from ten to twenty times.
This issue arose only few times, let's say 6 or 7 times.
It looks like the timer doesn't fire. Today I was more prepared than before: previously I scattered around the code many logs statements.
So I pluged in the usb cable with the issue live on my phone and typed "flutter logs" and then clicked "Cancel" and then "Start" again.
And there was no ticking log... So I started to google around, check the github issues, stack overflow... but I found nothing.
Meanwhile, I looked again on my phone screen and the countdown timer was counting again!
Infact, if you look the logs with the issue, notice that the timer jumps from "25:00" to "16:34"! It looks like after some 9 minutes, the timer started to tick!
Weird...
Anyway, I don't have any POC... or minimal test set... I just dropped few lines in the case somebody else bump into this...
Thank you for your great work guys!
cheers
Simone
session.start = new DateTime.now();
//...
_timer?.cancel();
_timer = new Timer.periodic(new Duration(milliseconds: 100), (Timer t) {
//...
});
------flutter logs (with the issue)
I/flutter ( 509): setDuration 25
I/flutter ( 509): changing from 25:00 to 16:34
I/flutter ( 509): changing from 16:34 to 16:33
I/flutter ( 509): changing from 16:33 to 16:32
I/flutter ( 509): changing from 16:32 to 16:31
I/flutter ( 509): changing from 16:31 to 16:30
------flutter logs (without the issue)
I/flutter ( 509): setDuration 25
I/flutter ( 509): changing from 25:00 to 24:59
I/flutter ( 509): changing from 24:59 to 24:58
I/flutter ( 509): changing from 24:58 to 24:57
etc etc