Marko Novina
11/10/2022, 6:54 AMe: /***/shared/src/commonMain/kotlin/*/*/*/root/RootComponent.kt: (38, 10): This class does not have a constructor
Line that reports is where I use @Parcelize
annotation.
I use latest version of decompose: 1.0.0-alpha-07-native-compose.
I will share code in 🧵 ⬇️Marko Novina
11/10/2022, 6:55 AMpackage somepackage.root
import com.arkivanov.decompose.ComponentContext
import com.arkivanov.decompose.router.stack.ChildStack
import com.arkivanov.decompose.router.stack.StackNavigation
import com.arkivanov.decompose.router.stack.childStack
import com.arkivanov.decompose.value.Value
import com.arkivanov.essenty.parcelable.Parcelable
import com.arkivanov.essenty.parcelable.Parcelize
import somepackage.LoginComponent
import somepackage.LoginComponentImpl
interface RootComponent {
val routerState: Value<ChildStack<*, Child>>
sealed class Child {
data class Login(val component: LoginComponent) : Child()
}
}
class RootComponentImpl(context: ComponentContext) : ComponentContext by context, RootComponent {
private val navigation = StackNavigation<Config>()
override val routerState: Value<ChildStack<*, RootComponent.Child>>
get() = childStack(
source = navigation,
initialConfiguration = Config.Login,
handleBackButton = true,
childFactory = ::createChild
)
private fun createChild(config: Config, context: ComponentContext) = when (config) {
is Config.Login -> RootComponent.Child.Login(LoginComponentImpl(context))
}
sealed class Config : Parcelable {
@Parcelize
object Login : Config()
}
}
Arkadii Ivanov
11/10/2022, 9:58 AMMarko Novina
11/10/2022, 10:09 AM./gradlew assembleStagingDebug
But I also noticed now that it also throws another error:
***/RootComponent.kt: (39, 9): Object 'Login' is not abstract and does not implement abstract base class member public abstract fun describeContents(): Int defined in somepackage.root.RootComponentImpl.Config
But this doesn’t make sense also 🤔
IDE (Android Studio) doesn’t highlight any errors.Arkadii Ivanov
11/10/2022, 10:11 AMArkadii Ivanov
11/10/2022, 10:14 AMMarko Novina
11/10/2022, 10:15 AMMarko Novina
11/10/2022, 10:23 AMArkadii Ivanov
11/10/2022, 10:27 AMabu naser
04/16/2023, 1:27 AMArkadii Ivanov
04/16/2023, 8:55 AMArkadii Ivanov
04/16/2023, 8:56 AM