Simon Lin
11/16/2020, 5:42 AMval onSuccess = SingleLiveEvent<Unit>()
fun load() {
// do something
onSuccess.call()
}
Ali Albaali
11/16/2020, 6:28 AMtseisel
11/16/2020, 8:04 AMAndrea Nicoletti
11/16/2020, 8:26 AMMichael Ferguson
11/17/2020, 2:19 PMreceiveAsFlow
so that on configuration change if an event is emitted with no observers it’s not dropped. (The channel buffers while there are no observers while SharedFlow is hot.) There are some caveats when doing that though.
https://medium.com/@elizarov/shared-flows-broadcast-channels-899b675e805c
Has a really good explanation of that “single shot event” use case.