var source = 1
flowOf(source).transform { while(true) emit(it) }
When I change
source
to a different value I want the infinite
transform { while(true) }
to get cancelled and to instead create a new infinite transform of 2 (currently it will always emit 1, which is not what I want). Is there any easy way to achieve that?
Edit: