[英]Drop operations when new value is emitted
Is there a way to drop all operations on a flow that is being collected when a new value is emitted, so that the new value gets to be processed while the old one is dropped and not processed further down the flow once the new value is emitted?有没有办法在发出新值时丢弃正在收集的流上的所有操作,以便在发出新值时处理新值而丢弃旧值并且不会在发出新值后在流中进一步处理?
I believe you're looking for Flow.collectLatest我相信您正在寻找 Flow.collectLatest
kotlinx.coroutines.flow/collect-latest kotlinx.coroutines.flow/collect-latest
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.