EntryProviderBuilder



DSL for constructing a new NavEntry

Parameters
<T : Any>

the type of the NavEntry key

Summary

Public constructors

<T : Any> EntryProviderBuilder(fallback: (unknownScreen) -> NavEntry<T>)
Cmn

Public functions

Unit
<T : Any> addEntryProvider(
    clazz: KClass<T>,
    clazzContentKey: (key) -> Any,
    metadata: Map<StringAny>,
    content: @Composable (T) -> Unit
)

Builds a NavEntry for the given clazz that displays content.

Cmn
Unit
<T : Any> addEntryProvider(
    key: T,
    contentKey: Any,
    metadata: Map<StringAny>,
    content: @Composable (T) -> Unit
)

Builds a NavEntry for the given key that displays content.

Cmn
(T) -> NavEntry<T>

Returns an instance of entryProvider created from the entry providers set on this builder.

Cmn

Extension functions

inline Unit
<T : Any> EntryProviderBuilder<*>.entry(
    noinline clazzContentKey: (key) -> Any,
    metadata: Map<StringAny>,
    noinline content: @Composable (T) -> Unit
)

Add an entry provider to the EntryProviderBuilder

Cmn
Unit
<T : Any> EntryProviderBuilder<T>.entry(
    key: T,
    contentKey: Any,
    metadata: Map<StringAny>,
    content: @Composable (T) -> Unit
)

Add an entry provider to the EntryProviderBuilder

Cmn

Public constructors

EntryProviderBuilder

<T : Any> EntryProviderBuilder(fallback: (unknownScreen) -> NavEntry<T>)
Parameters
<T : Any>

the type of the NavEntry key

fallback: (unknownScreen) -> NavEntry<T>

the fallback NavEntry when the provider cannot find an entry associated with a given key on the backStack

Public functions

addEntryProvider

fun <T : Any> addEntryProvider(
    clazz: KClass<T>,
    clazzContentKey: (key) -> Any = { defaultContentKey(it) },
    metadata: Map<StringAny> = emptyMap(),
    content: @Composable (T) -> Unit
): Unit

Builds a NavEntry for the given clazz that displays content.

Parameters
<T : Any>

the type of the key for this NavEntry

clazz: KClass<T>

the KClass of the key for this NavEntry

clazzContentKey: (key) -> Any = { defaultContentKey(it) }

A factory of unique, stable ids that uniquely identifies the content of this NavEntry. To maximize stability, it should ge derived from the factory's provided key. The resulting key must be saveable (i.e. on Android, it should be saveable via Android). The generated key will be stored in NavEntry.contentKey.

metadata: Map<StringAny> = emptyMap()

provides information to the display

content: @Composable (T) -> Unit

content for this entry to be displayed when this entry is active

addEntryProvider

fun <T : Any> addEntryProvider(
    key: T,
    contentKey: Any = defaultContentKey(key),
    metadata: Map<StringAny> = emptyMap(),
    content: @Composable (T) -> Unit
): Unit

Builds a NavEntry for the given key that displays content.

Parameters
<T : Any>

the type of the key for this NavEntry

key: T

key for this entry

contentKey: Any = defaultContentKey(key)

A unique, stable id that uniquely identifies the content of this NavEntry. To maximize stability, it should ge derived from the key. The contentKey type must be saveable (i.e. on Android, it should be saveable via Android). Defaults to key.toString().

metadata: Map<StringAny> = emptyMap()

provides information to the display

content: @Composable (T) -> Unit

content for this entry to be displayed when this entry is active

build

fun build(): (T) -> NavEntry<T>

Returns an instance of entryProvider created from the entry providers set on this builder.

Extension functions

inline fun <T : Any> EntryProviderBuilder<*>.entry(
    noinline clazzContentKey: (key) -> Any = { defaultContentKey(it) },
    metadata: Map<StringAny> = emptyMap(),
    noinline content: @Composable (T) -> Unit
): Unit

Add an entry provider to the EntryProviderBuilder

Parameters
<T : Any>

the type of the key for this NavEntry

noinline clazzContentKey: (key) -> Any = { defaultContentKey(it) }

A factory of unique, stable ids that uniquely identifies the content of this NavEntry. To maximize stability, it should ge derived from the factory's provided key. The resulting key must be saveable (i.e. on Android, it should be saveable via Android). The generated key will be stored in NavEntry.contentKey.

metadata: Map<StringAny> = emptyMap()

provides information to the display

noinline content: @Composable (T) -> Unit

content for this entry to be displayed when this entry is active

fun <T : Any> EntryProviderBuilder<T>.entry(
    key: T,
    contentKey: Any = defaultContentKey(key),
    metadata: Map<StringAny> = emptyMap(),
    content: @Composable (T) -> Unit
): Unit

Add an entry provider to the EntryProviderBuilder

Parameters
<T : Any>

the type of the key for this NavEntry

key: T

key for this entry

contentKey: Any = defaultContentKey(key)

A unique, stable id that uniquely identifies the content of this NavEntry. To maximize stability, it should ge derived from the key. The contentKey type must be saveable (i.e. on Android, it should be saveable via Android). Defaults to key.toString().

metadata: Map<StringAny> = emptyMap()

provides information to the display

content: @Composable (T) -> Unit

content for this entry to be displayed when this entry is active