Want to get data from api every x seconds in flutter? Use the below example code to get data from API every x seconds in your flutter application.
1 2 3 4 5 | Stream <int> getPeriodicStream() async* { yield* Stream.periodic(Duration(seconds: 30), (_) { return await PostData.browse(); }); } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.