Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
private val _searchQuery = MutableStateFlow("")
fun setSearchQuery(query: String) {
_searchQuery.value = query
}
val networkOperationResult: Flow<String> = _searchQuery.debounce(1000).mapLatest {
if (it.isEmpty()) {
return@mapLatest ""
} else {
Log.e("Latest Mapped String Query", it)
return@mapLatest longNetworkOperation(it)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment