In Kotlin there is Flow.flatMapLatest() function that:
Returns a flow that switches to a new flow produced by transform function every time the original flow emits a value. When the original flow emits a new value, the previous flow produced by transform block is cancelled.
Is there an equivalent function for Dart's Stream?
Nothing existing, but it should be fairly easy to write.