Basically, I have a bunch of ListTiles on my home page which represents some timers. When I press a ListTile it navigator goes to another page with an option to set a timer and a cool clock animation. Now when I go back to the home page the animation and that complete page get disposed. but I want the timer to continue even if we close the page. Can I get a good suggestion to implement this idea?
Asked
Active
Viewed 252 times
0
-
Are you cancelling the timer in the dispose method of its page? My understanding is that timers continue to run until u cancel them. – GrahamD May 06 '20 at 18:53
-
I'm not using Timers. I mean I wasn't aware of such a class exists. Let me try the same using timers. – Richard J May 07 '20 at 03:19
-
Ok, if you don't come right maybe share minimal snippets of your code otherwise everyone is guessing. – GrahamD May 07 '20 at 06:32
-
I did it with timers. It worked. Thanks – Richard J May 07 '20 at 10:45
-
Great, glad I helped albeit indirectly – GrahamD May 07 '20 at 15:20
1 Answers
1
In your stateful widget, include a mixin like this!
class _ClassNameState extends State<ClassName> with AutomaticKeepAliveClientMixin<Upload> {
//code
}

Abbas
- 773
- 6
- 16
-
I don't understand how AutomaticKeepAliveClientMixin works. I tried including it as you said, but no luck. – Richard J May 07 '20 at 03:45