In Flutterd, I have an int timer value that is thrown to the button when the button is pressed, so that this value continues to run even if the application is closed. and when I close and open the application, this remaining time will be displayed instantly in text, but I could not do it, how can I save the timer to local memory?
I tried with shared preferences but I couldn't do it
i build this function in flutter with GetX to make user get prize after the user click in yhe prize the timer will be start to 24 hours ,after the user close app and return the timer will be countuned from the last user action by checking the time i saved into local storage and calcualte the different between this time saved and DateTime.now(), this is the code , but i use GetStorage not use the shared preference :
decleare this var
and oninit the class check for the user if can get prize or not
the build the _loadTimerState() function :
this the function to getPrize when user click on the button :
and the build ETA Timer in this function
in youre UI use TimerBuilder package to build timer running like this :