I’m using timer for refreshing data from
timer = Timer.periodic(Duration(seconds: 60), (Timer t) async {
await getList();
})
Its working fine.
I want to pause timer until getList proc completed. The proc itself take 30 to 120 second.
So is their any option to pause timer?
Thanks in Advance.
2
Answers
There is an open issue for your problem. Dart sdk doesn’t provide pause or restart feature for Timer. You can use this package which does the job for you. Or use
Stream.periodic()
which was mentioned in the comment. Hope this helps.I think you will prefer this kind of solution.
don’t forget to cancel timer