NavGraphKt

Added in 1.0.0

public final class NavGraphKt


Summary

Public methods

static final boolean
contains(@NonNull NavGraph receiver, @IdRes int id)

Returns true if a destination with id is found in this navigation graph.

static final boolean
<T extends Object> contains(
    @NonNull NavGraph receiver,
    @NonNull KClass<@NonNull T> route
)

Returns true if a destination with route is found in this navigation graph.

static final boolean
contains(@NonNull NavGraph receiver, @NonNull String route)

Returns true if a destination with route is found in this navigation graph.

static final boolean
<T extends Object> contains(@NonNull NavGraph receiver, @NonNull T route)

Returns true if a destination with route is found in this navigation graph.

static final @NonNull NavDestination
get(@NonNull NavGraph receiver, @IdRes int id)

Returns the destination with id.

static final @NonNull NavDestination
<T extends Object> get(@NonNull NavGraph receiver, @NonNull KClass<@NonNull T> route)

Returns the destination with route from KClass.

static final @NonNull NavDestination
get(@NonNull NavGraph receiver, @NonNull String route)

Returns the destination with route.

static final @NonNull NavDestination
<T extends Object> get(@NonNull NavGraph receiver, @NonNull T route)

Returns the destination with route from an Object.

static final void

Removes node from this navigation graph.

static final void

Adds a destination to this NavGraph.

static final void

Add all destinations from another collection to this one.

Public methods

public static final boolean contains(@NonNull NavGraph receiver, @IdRes int id)

Returns true if a destination with id is found in this navigation graph.

public static final boolean <T extends Object> contains(
    @NonNull NavGraph receiver,
    @NonNull KClass<@NonNull T> route
)

Returns true if a destination with route is found in this navigation graph.

public static final boolean contains(@NonNull NavGraph receiver, @NonNull String route)

Returns true if a destination with route is found in this navigation graph.

public static final boolean <T extends Object> contains(@NonNull NavGraph receiver, @NonNull T route)

Returns true if a destination with route is found in this navigation graph.

public static final @NonNull NavDestination get(@NonNull NavGraph receiver, @IdRes int id)

Returns the destination with id.

Throws
kotlin.IllegalArgumentException

if no destination is found with that id.

public static final @NonNull NavDestination <T extends Object> get(@NonNull NavGraph receiver, @NonNull KClass<@NonNull T> route)

Returns the destination with route from KClass.

Throws
kotlin.IllegalArgumentException

if no destination is found with that route.

public static final @NonNull NavDestination get(@NonNull NavGraph receiver, @NonNull String route)

Returns the destination with route.

Throws
kotlin.IllegalArgumentException

if no destination is found with that route.

public static final @NonNull NavDestination <T extends Object> get(@NonNull NavGraph receiver, @NonNull T route)

Returns the destination with route from an Object.

Throws
kotlin.IllegalArgumentException

if no destination is found with that route.

public static final void minusAssign(@NonNull NavGraph receiver, @NonNull NavDestination node)

Removes node from this navigation graph.

public static final void plusAssign(@NonNull NavGraph receiver, @NonNull NavDestination node)

Adds a destination to this NavGraph. The destination must have an id set.

The destination must not have a parent set. If the destination is already part of a NavGraph, call NavGraph.remove before calling this method.

Parameters
@NonNull NavDestination node

destination to add

public static final void plusAssign(@NonNull NavGraph receiver, @NonNull NavGraph other)

Add all destinations from another collection to this one. As each destination has at most one parent, the destinations will be removed from the given NavGraph.

Parameters
@NonNull NavGraph other

collection of destinations to add. All destinations will be removed from the parameter graph after being added to this graph.