Kotlin flow map - make emit even if the value is same
I want to know the kotlin flow flatMap working with jetpack compose
I am having a flow for search and i am calling the api each time the search value changes.
var search = MutableStateFlow("")
And to call api
var allItems = search.flatMapLatest{query->
flow{
emit(repository.getAllItems(query)
}
}
It works perfectly fine , but excpet in one scenario.
When the value of search is already "" an empty string, and i try to refresh the page , the code inside flatmap is not working...