Hi I have a question regarding flutter I am building a live radio app using flutter for iOS and Android the application have 2 pages one for all shows details like timings name etc which I will get from api backend is nodejs and MySQL and one for playing audio I want live show image on the main screen and also upcoming 2 shows and pass away 2 shows at the bottom of live show image using api data which will changes time to time schedule details I am catching from api how to do that ? Is there ani plugin available or not
CodePudding user response:
Use
Timer.periodic
Timer.periodic(Duration(seconds:10), (var timer){
//fetch your data and update state
}
https://api.dart.dev/stable/2.14.3/dart-async/Timer/Timer.periodic.html
CodePudding user response:
The Timer.Periodic that Kozubi suggests can be used together with a StreamBuilder widget.
See the following answer.
A StreamBuilder is a good way to display changing data. The StreamBuilder listens to changes in the data and the output will be changed accordingly.