I'd love to know if anyone has explored the Unidir...
# android
a
I'd love to know if anyone has explored the Unidirectional Data Flow for Android? I took a unique approach implementing it with LiveData + Kotlin as opposed to RxJava. A few major Kotlin benefits with this pattern are the
Sealed class
and the shallow
.copy(..)
function. I'd love any feedback on this new approach! 🙂 🤖 Medium - https://hackernoon.com/android-unidirectional-flow-with-livedata-bf24119e747 YouTube -

https://youtu.be/Elp-Z-pQTpMâ–¾

😲 3
b
Undirectional Data Flow It's a great approach, but it's going to be better when
Compose
gets released and actually I'm using coroutines (
Flow
extension) to implement a kind of Redux implementation https://gist.github.com/bloderxd/830e92702b92c4cf0906c57e54726e14
but it's a good approach, I'm just pretty excited about compose to use better
s
There is no need to wait for Compose to try Declarative UI on Android, it is already there
b
how do u try that without Compose? Let's suppose you have this:
Copy code
fun render(state: MyState) {
 
}
this
MyState
is the view state, how do u render that today properly with no imperative way? 🤔
of course u can build tools for that, but just with android framework, how do u do?
using databinding?
s
Different ways. You can use declarative UI libraries like Litho, Anko, Anvil which allows exactly this. But if you still prefer plain old xml for some reason, you can mimic this render() method by your own.
b
Yeah I can create tools for that but I'm waiting some kind of official support to that.
s
My point is that you don't even need to create one, they are already there. But yes, they are not "official"
a
Hey @bloder, @sngrekov, I am just seeing these messages now. I switched from Slack web to the app so that I'll receive realtime notifications moving forward! 📬
@bloder, Thank you for the feedback! I haven't explored
Compose
yet. I've started using Coroutines to handle basic threading use cases, but need to look into the
Flow
extension. Your code sample is interesting!