79477835

Date: 2025-03-01 15:38:15
Score: 1.5
Natty:
Report link

When retrieving a route, you must define a concrete class or object (not an interface or abstract class). To check the selected destination use hasRoute for example:

val dst = if (backStackEntry?.destination?.hasRoute(WelcomeDestination::class)) {  
    backStackEntry?.toRoute<WelcomeDestination>()  
}else if .. 

Each destination must be annotated with @Serializable. For a full explanation, watch: Navigation Compose meet Type Safety

Reasons:
  • Has code block (-0.5):
  • User mentioned (1): @Serializable
  • Starts with a question (0.5): When
  • Low reputation (0.5):
Posted by: Ori S