I am creating this class as part of a tutorial for Compose navigation.
sealed class Screens(val route: String) {
object Screen1 : Screens( route: "screen1")
object Screen2 : Screens( route: "screen2")
}
I am getting the error "Expecting member declaration". What does this error mean in simple terms?
CodePudding user response:
It should either be Screens("screen1")
or (if you want to use named arguments) Screens(route="screen1")
, with a =
.
That error is because the syntax you're using (with the colon) is confusing the compiler, it doesn't make sense there