I have a model object that will return a Flow<List<Result>> based on a string query. (happens to be Jetpack Room but that isn’t important) I have a StateFlow for the query parameter. I’d like to obtain a flow that will always reflect the flow obtained from the model object based on the current value of the StateFlow for the query parameter.
My current implementation is essentially
queryStateFlow.flatMapLatest { query ->
model.getSearchResultsFlow(query)
}
Is that the best way to do that? I notice flatMapLatest is still experimental, is there a non-experimental way to achieve this instead?