https://kotlinlang.org logo
#compose
Title
# compose
n

Norbi

05/27/2022, 8:23 PM
Sometimes I see state properties in classes, eg. in https://blog.canopas.com/android-drag-and-drop-ui-element-in-jetpack-compose-14922073b3f1
Copy code
...

internal class DragTargetInfo {
    var isDragging: Boolean by mutableStateOf(false)
    ...
    var draggableComposable by mutableStateOf<(@Composable () -> Unit)?>(null)
    ...
}

...

internal val LocalDragTargetInfo = compositionLocalOf { DragTargetInfo() }

...
Is this a good pattern for state management?
👌 7
c

Colton Idle

05/27/2022, 9:14 PM
This is basically all I do. flows scare me and ive gotten away building 2 full prod compose apps with mutableState*
😮 1
🙏 1
5 Views