Hey I have a question about `callbackFlow` again. ...
# coroutines
k
Hey I have a question about
callbackFlow
again. How would you review following code:
Copy code
fun TextView.onTextChange() = callbackFlow {
    val listener = addTextChangedListener { text ->
        if (text != null) {
            offer(text.toString())
        }
    }
    awaitClose { removeTextChangedListener(listener) }
}
d
That looks fine.
d
You may want to conflate it, in order to have the last value only
k
Good idea it makes sense to have the last value in this usecase. Thank you