'What does "Expecting member declaration" mean?
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?
Solution 1:[1]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | cactustictacs |
