https://kotlinlang.org logo
i

Ian Warwick

03/02/2020, 11:11 AM
Some ramblings on LiveData usage, interested in feedback on how other folks are using LiveData so far with compose https://medium.com/@fluxtah/another-way-of-using-livedata-with-jetpack-compose-77a28c287af9?sk=69d5bf1973cffcb7d3665a33a405e99c
👍 3
a

Adam Powell

03/02/2020, 2:09 PM
You could get rid of that recompose block by using
var doError by mutableStateOf(true)
The way you wanted to set up that DSL for observing is exactly why I like the idea of a suspending
effect {}
API like I mentioned in the other thread. It would let you write code like:
Copy code
effect {
  doOnStartThings()
  liveData.asFlow().collect {
    doOnResultThings(it)
  }
}
👍 1
i

Ian Warwick

03/02/2020, 2:28 PM
nice @Adam Powell cheers will try that, I did think about using some state flag here but I guess it would always need to be reset back 🤔 though looking forward to what you guys come up with in regards to this
👍 1
a

Adam Powell

03/02/2020, 2:40 PM
I'm spending a bunch of time thinking about the above and what it means for composability of time-driven factors. Data updates like this, animations, gestures over time, all of it can potentially speak the same language and get much easier to interleave and interact with
❤️ 6
i

Ian Warwick

03/02/2020, 2:43 PM
nice one! Totally looking forward to that! 🙂 specially coroutine integration.