Skip to content

Why not produce State from the Jetpack Compose, instead of Flow or StateFlow? #59

Answered by JakeWharton
dev-gvs asked this question in Q&A
Discussion options

You must be logged in to vote

We don't really use Compose UI yet, so State is a somewhat useless type to us. Our returned StateFlow is collected by our presenter-render integration layer which passes the models to the renderer which are almost entirely views. Additionally, StateFlow is a type which represents both a synchronously-available value as well as a mechanism by which you can subscribe to updates. With State you only get the former and have to use snapshotFlow for the latter. Except because of Google's failure to ship Compose in a true multiplatform context we cannot pass around State to multiplatform code whereas StateFlow is fully multiplatform.

Supporting State is as trivial as our StateFlow support which …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@dev-gvs
Comment options

@DSteve595
Comment options

Answer selected by dev-gvs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants