RouteBuilder

Use the DSL functions to build the expected route handled by a Router. If two routes match the same path, the first declared route is chosen.

With dynamic routing displaying will not stop if two routes of the same kind match the current route:

wrong usage:

    if (true) {
int {
Text("Match")
}
}
int {
Text("Will be displayed too")
}

correct usage:

    if (true) {
int {
Text("Match")
}
} else {
int {
Text("Won't be displayed")
}
}

Types

Link copied to clipboard
object Companion
Link copied to clipboard
class NoMatch(val remainingPath: String, val parameters: Parameters?)

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
@Composable
fun int(nestedRoute: @Composable RouteBuilder.(Int) -> Unit)

Executes its children when the requested subroute is a Int.

Link copied to clipboard
@Composable
fun noMatch(content: @Composable RouteBuilder.NoMatch.() -> Unit)

Fallback if no matching route is found.

Link copied to clipboard
@Composable
fun redirect(vararg route: String, target: String, hide: Boolean = false)
Link copied to clipboard
@Composable
fun route(vararg route: String, nestedRoute: @Composable RouteBuilder.() -> Unit)

Executes its children when the requested subroute matches one of these constant route.

Link copied to clipboard
@Composable
fun string(nestedRoute: @Composable RouteBuilder.(String) -> Unit)

Executes its children when the requested subroute is a non-empty String.