shalutd / StateFlowDemo

StateFlow is an alternative for LiveData. If your project using coroutine, then you can use SateFlow instead of LiveData for dataBinding.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

StateFlowDemo

StateFlow can be used instead of LiveData for databinding. But StateFlow only applicable with kotlin but LiveData can be used with both Java and Kotlin. If your project using coroutine, then we can use SateFlow instead of LiveData for databinding.

This demo project describes one way and two way databinding with StateFlow.

In the app, the top textview listing some places names using one way databinding. We have an edittext, while you typing in it, it will automatically append the text to the above textview. Here, two way databinding added for this edittext.

About

StateFlow is an alternative for LiveData. If your project using coroutine, then you can use SateFlow instead of LiveData for dataBinding.


Languages

Language:Kotlin 100.0%