Thread
#compose
    l

    Loboda Deni

    2 years ago
    Hello, can I put the code in a class? something like that:
    abstract class BaseState(
        private val textState: String
    ) {
    
        @Composable
        fun render() {
            Text(
                modifier = Modifier.padding(8.dp),
                text = textState
            )
            renderChild()
        }
    
        @Composable
        protected abstract fun renderChild()
    }
    I get an error: e: java.lang.IllegalStateException: Cannot find the Composer class
    i want to split states of a fragment into separate classes. it would be nice to implement some kind of state machine, has anyone done that?
    Timo Drick

    Timo Drick

    2 years ago
    I do use classes and define @Composable functions inside. So this is working. I am also unsing interfaces to define commen functions. But i did not used abstract classes. So not sure if this is the problem.