More samples
If the recent Coding with the Italians podcast has taught me anything it's that we need more samples which showcase the usage outside of the traditional Android usage.
- [ ] Ktor server sending state over a web socket
- [ ] Test of regular Compose UI logic (Android and JVM desktop)
- [ ] Data layer stuff? We show a lot of presentation layer but this can be used anywhere.
- [ ] Cheap version of Mosaic rendering strings for terminal using K/N
For reference: https://www.youtube.com/watch?v=O70beCWbSCY
- [ ] rememberSaveable plumbing
@JakeWharton on the data layer side of things: do you have a vision for how you think it should look? I've been thinking about this exact concept quite a bit. Happy to contribute if it'd be helpful, let me know if you've got initial thoughts and I'll build something out.
No ideas. Maybe maintaining pagination state of some remote API?
One thing I'd like a sample on (if it's supported) is whether or not you can nest molecule flows. E.g. a Composeable in a Molecule scope calls "collectAsState()" on another flow that is also a molecule flow. It's not clear to me whether or not that's an anti-pattern based on the docs.
Nothing should prevent that from working, but I wouldn't encourage it too much. That can be useful if you're going through some abstraction layer that only supports flows or you need to apply some operator first (like sharing/replay), but otherwise you could make the @Composable function driving the flow directly available to the one collecting the flow and do a direct call for the same result.
@JakeWharton That makes sense, thanks! This is basically for a case where I might have an arbitrary molecule flow in my data layer for the sole reason that it's simply easier to to use Compose than a bunch of Flow operators to achieve what I'm trying to do. But it's good to know this isn't necessarily recommended.