textChanges
Create a InitialValueFlow of text changes on the TextView instance where the value emitted is the current text.
Note: Values emitted by this flow are mutable owned by the host TextView and thus are not safe to cache or delay reading (such as by observing on a different thread). If you want to cache or delay reading the items emitted then you must map values through a function which calls String.valueOf() or CharSequence.toString() to create a copy.
Note: Created flow keeps a strong reference to the TextView instance until the coroutine that launched the flow collector is cancelled.
Example of usage:
textView.textChanges()
.onEach { text ->
// handle text
}
.launchIn(uiScope)
Content copied to clipboard