I'm really interested in Compose, but I currently represent all my data (model) as immutable data. I use
Flow<T>
for this. Every instance of
T
is immutable all the way down, which has a bunch of advantages.
@Model
seems to require use of
var
👍 1
zak.taccardi
10/23/2019, 7:08 PM
Does Compose support fully immutable data?
l
Luca Nicoletti
10/23/2019, 7:09 PM
You can setup an observable to your flow and save a
mutable state
which get updated everytime your immutable data emits
j
jim
10/23/2019, 7:11 PM
Yes, Compose loves immutable data We provided
@Model
for people who's applications are already designed for mutable data or otherwise find it hard to work with immutable data. If you are already using immutable data, great!