07/04/2022, 1:11 PM
Periodically refresh Kotlin flow (polling) How shoud I peridically "refresh" kotlin flow, to get fresh data. I have list of book id's stored in room database. From network api I get the actual books using the stored ids. My goal is to listen database changes and map the book ids to actual books. That works fine. The problem is, how shoud I re-fetch periodically book data from network api but still keep listening the database all the time? So changes in book ids in database shoud allways trigger network api call (booksApi.get()). fun...