how can I use collections functions inside of a co...
# compose
d
how can I use collections functions inside of a composable function? Like i need to pass the @composable context to the map function on a flow. Example :
Copy code
val windowSize: State<DpSize> = windowSize().map {
                with(LocalDensity.current) {
                    DpSize(it.first.toDp(), it.second.toDp())
                }
            }.collectAsState(DpSize(800.dp, 600.dp))
e
presumably
windowState()
returns a
Flow
? (I would consider flow functions separate from collections functions, even if they have the same names)
notably here, collections functions are inlined, but flow functions are not and may run outside of the current context, meaning you cannot use
@Composable
functions within flows
💡 1
next time please keep to a single thread 🧵 so that responses are not split up
👍 1