Peter
val flow = MutableStateFlow<String?>(null) fun get(): Flow<String> { // If not loaded yet if (flow.value == null) { val init = flowOf { load() emit(flow.value) } return combine(init, flow.asSharedFlow()) } else { flow.asSharedFlow() } } suspend fun load() = TODO()
flow.asSharedFlow().onStart { load() }
Mofe Ejegi
onStart
A modern programming language that makes developers happier.