Why `collectAsState` under the hood does use `coll...
# compose
v
Why
collectAsState
under the hood does use
collect
and not
collectLatest
?
s
That would be incredibly confusing if it just did so internally without explaining it in the name of the function
👌 1
a
The difference between them only matters if you run some cancellable actions (typically suspend functions) in the collect block. In
collectAsState()
, there is only a
value = it
call which is not cancellable anyway, in which case
collect()
should be used because it has less machinery.