stop_watch_timer
stop_watch_timer copied to clipboard
HELP - How can you trigger an action when countdown reaches 0 ?
I am a beginner developer with Flutter. Am using your package to display a countdown stopwatch. To manage state, I use the package Provider. Question 1 - Is it possible to manage the stream in my provider file and just "send" the "Displaytime" to the screen where the countdown must be displayed ? Question 2 - Is there a way to trigger an action when countdown reaches 0 ? In my app, when it reaches 0, it must change part in the test (it's a testing app for English learner). They have 3 minutes to answer 5 questions. (5 questions per part). So when they are out of time, it must change part... I just can't get it to work. I am not very good with Streams, so it's probably where I make a mistake. Can you help me ?
Please check the following interface.
Question 1
_stopWatchTimer.rawTime.listen((value) => print('rawTime $value ${StopWatchTimer.getDisplayTime(value)}'));
_stopWatchTimer.minuteTime.listen((value) => print('minuteTime $value'));
_stopWatchTimer.secondTime.listen((value) => print('secondTime $value'));
Question 2
_stopWatchTimer.fetchStopped.listen((value) => print('stopped from stream'));
_stopWatchTimer.fetchEnded.listen((value) => print('ended from stream'));