Questions tagged [flutter-timer]

21 questions
1
vote
0 answers

How to reset a timer whenever the app goes to the background?

I am trying to get my countdown timer to reset when the app goes to the background. I currently can detect the different App Lifecycle states, but can't figure out how to trigger a timer reset when the "paused" state is detected. The App lifecycle…
1
vote
1 answer

Flutter - timer bugs out when the screen is locked

I'm trying to create countdown timer where I keep track off the session when it starts. I'm using the timer when the app is in background it runs fine but when the app is in background and the screen is locked the timer does not work properly. I…
1
vote
1 answer

Timer doesn't cancel - Flutter Provider

The objective of my app is when I tap on start button, a timer should start which will run a function every 5 seconds, and when stopped the timer should cancel and stop that function from running. (Now I have different screens for the same purpose…
dev1ce
  • 1,419
  • 1
  • 19
  • 39
1
vote
0 answers

Flutter: How to make an accurate timer in flutter?

I know to make a timer in flutter but as other platforms for e.g. game engines and android studio there is always a delta value that is the difference between two frames and it ensures accuracy. In flutter I fund no way to access delta. There is a…
Manav Sarkar
  • 89
  • 1
  • 9
1
vote
1 answer

Flutter: Timer can not stop

My code is below. I try to close this timer. timer could not close. What can I do to close this timer? I need help immediatly. Timer timerHttp; @override void initState() { timerHttp = Timer.periodic(new Duration(seconds: 10), (timerHttp) async…
SefaUn
  • 824
  • 1
  • 7
  • 23
1
vote
2 answers

Why everything is being reinitialized every second after adding periodic Timer in Flutter?

I'm trying to build a quiz app. When any user starts to participate in a quiz a timer starts and don't know why everything is being reinitialized every second. The boolean parameter 'answered' is being set as false every second. As a result the…
1
vote
2 answers

Flutter Countdown Timer for Chess App ( stuck in the logic)

So from past few day I have been trying to get around this logical loop, and have tried everything I could and then finally decided to post it here (hence made my debut here). I am stuck, all the help is appreciated. Thanks ! Logic: In the app there…
1
vote
1 answer

How to get the total time passed flutter - Working with timer flutter

I have a Timer that has a small animation which is a circle around it. The Timer is called from another route to start (ExamTimer(size: 40.0),). And when ever I navigate to another route I get the following Error: ════════ Exception caught by…
Taba
  • 3,850
  • 4
  • 36
  • 51
0
votes
2 answers

How to fix timer and color change on click Flutter?

I am trying to create simple test, where if user clicks on the right answer, button background changes to green and stays green for 3 seconds. I implemented set state with timer, but the background change is too instant still, hence timer is not…
0
votes
0 answers

FLUTTER. Various individual/unique TIMERS

I'm doing an APP in FLUTTER and I'm new with it and also new with Dart (I have decent experience with Java and Kotlin), and my problem(question) is this; I have a list populated with items, when you click in one of the items, it redirects you to…
Quino92
  • 1
  • 1
0
votes
1 answer

How can I stop Timer period in Flutter?

class _LiftButtonLayerState extends State { late Timer _timer; late double _timeElapsed; var isPause = false; var isTrue = true; @override void initState() { super.initState(); } repeatDownActivate() { …
0
votes
0 answers

Timer.periodic is creating multiple request if the function is being triggered multiple times

I have used to Timer.periodic in flutter to run a function for every minnute final periodicTimer = Timer.periodic( const Duration(minutes: 1), (timer) { print('some code here'); }); so…
John
  • 137
  • 2
  • 12
0
votes
0 answers

Are functions executed by Flutter's Timer thread safe?

Consider following code: class AppState extends ChangeNotifier { List collection = []; AppState() { Timer.periodic( const Duration(seconds: 1), (Timer t) async => await mutateCollection(), ); } Future…
Maciej Pszczolinski
  • 1,623
  • 1
  • 19
  • 38
0
votes
1 answer

Flutter function timeout

I am using flutter. I wrote a function, if it takes longer than 5 seconds, I want to redirect it to the page with a warning message. Is there an easy way to do this?
zey
  • 177
  • 2
  • 15
0
votes
1 answer

Flutter timer resets when switching page

In my flutter app there is a timer and a settings page. When the timer is running and I switch to the setting page (by using PageView), the timer gets reset or there is an error (Unhandled Exception: setState() called after dispose()) This happens…
1
2