I want to make a nice logic for forever looping and emitting results with Kotlin Flows. The use case is that every n minutes I need to update a configuration in my app and this configuration comes from a rest api.
I thought a nice solution would be to run a "scheduler" that polls the api every n minutes in the background, and a ConfigService which is subscribed to this scheduler can update it's own state when the scheduler emits a new value.
Using RxJava this would be
Observable.interval(n, TimeUnit.MINUTES)
.flatMap( ... )
But since I am using Kotlin I thought I could implement the same logic with the native Flow library. How would that look like? I was trying to google and either did not find the right keywords or just no one run into the same issue before?