Reputation: 3767
Currently working on home automation app, in which there is the events API that gives me the events if they are triggered. But i want to continuously run the API so that it will track the events that are triggered in the overall application. And there is a home page where i show the events in which ever occured. Its a simple rest APInot web sockets used, Its kind of request response type. Any suggestions that how can i implement it in a proper way. Currently using the Timer in every page.But this is not a good approach.
Upvotes: 0
Views: 1534
Reputation: 4035
You would definitely need to use Timer.periodic()
for period calls. I would suggest you follow this approach.
BLOC
or provider
as per your state management implementation.BLOC
or Provider
so the code will be modularized and you will be avoiding the duplicate code.Upvotes: 1