cost 58 ms
Kotlin Coroutine Flow: 限制收集器数量 - Kotlin Coroutine Flow: Limit the number of collector

有没有办法限制 function 中使用流构建器返回流的收集器数量? 我在 ViewModel 中有这个公共方法 此方法在 ViewModel 的init块上调用,但也可以在 UI 上手动调用。 此流每 10 秒发出一次值。 资料库 不幸的是,每次从 UI 调用fetch()时,我都注意到它会创建另 ...

当新值与上一个值相同时,StateFlow 不会发出 - StateFlow don't emit when the new value same last value

我有一个登录表单。 我使用StateFlow将LoginResult (调用 API 后)从ViewModel发送到Activity 。 在活动中,如果登录失败,我将显示一个错误对话框。 它第一次运行良好,但从我第二次登录失败后,错误对话框将不再显示。 我在StateFlow上测试了.value和. ...


排序:
质量:
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM