Hrodrick
11/26/2025, 2:18 PMval uiState = combine(
vehiclesRepository.getAll(),
tripInProgressRepository.tripInProgress,
transform = ::mapToUiState
).stateIn(
scope = viewModelScope,
started = WhileSubscribed(5_000),
initialValue = container.stateFlow.value,
)
This way I easily receive updates from the external flows and can keep control on when they are listened and for how long.
I couldn't find a way to implement this use case with orbit-mvi. I found alternatives but they are horrible lol.
I was thinking about adding a .onEach { intent { reduce { it } } } call before the stateIn, but I end up with 2 state holders which is not that good (container's state and this variable) but at least is easy to understand.
Any ideas?