Package 

Annotation NavGraph


  • @Target(allowedTargets = {AnnotationTarget.ANNOTATION_CLASS}) 
    public @interface NavGraph<T extends Annotation>
    
                        

    Annotation you can use on annotation classes that will signal the generating task to consider annotated Composable a part of the corresponding navigation graph.

    Example:

    @NavGraph<RootNavGraph> // marks SettingsNavGraph as a NavGraph annotation and RootNavGraph as parent
    annotation class SettingsNavGraph
    
    @Destination<SettingsNavGraph>(start = true)
    @Composable
    fun SettingsScreen() { /*...*/}

    The above annotation class defines a Navigation graph of name "settings" and a "Settings destination" that will belong to it (and it will be its start destination).

    In the above example, since "SettingsNavGraph" is annotated with "@NavGraph<RootNavGraph>", "settings" will be a nested navigation graph of "root". You could also do "@NavGraph<RootNavGraph>(start = true) if "settings" should be the start of "root".