mcpiroman
11/09/2021, 6:33 PMval foo = MutableStateFlow(10)
val baz = MutableStateFlow(10)
foo.collect { baz.value = it }
// Somewhere else
foo.value = 20
assertEquals(20, baz.value) // is this guaranteed? i.e. (how) can I expect value to be immediately updated?
Joffrey
11/09/2021, 6:47 PMmcpiroman
11/09/2021, 6:51 PMJoffrey
11/09/2021, 9:46 PMfoo
and the moment you read it from baz
so the only way the other coroutine can forward the value is if it runs in an other thread at the same time (and if you're lucky). So to answer in general: no, there is no such guarantee