EntryProviderBuilder


@EntryDsl
public final class EntryProviderBuilder<T extends Object>


DSL for constructing a new NavEntry

Parameters
<T extends Object>

the type of the NavEntry key

Summary

Public constructors

<T extends Object> EntryProviderBuilder(
    @NonNull Function1<@NonNull unknownScreen, @NonNull NavEntry<@NonNull T>> fallback
)

Public methods

final void
<T extends Object> addEntryProvider(
    @NonNull KClass<@NonNull T> clazz,
    @NonNull Function1<@NonNull key, @NonNull Object> clazzContentKey,
    @NonNull Map<@NonNull String, @NonNull Object> metadata,
    @Composable @NonNull Function1<@NonNull T, Unit> content
)

Builds a NavEntry for the given clazz that displays content.

final void
<T extends Object> addEntryProvider(
    @NonNull T key,
    @NonNull Object contentKey,
    @NonNull Map<@NonNull String, @NonNull Object> metadata,
    @Composable @NonNull Function1<@NonNull T, Unit> content
)

Builds a NavEntry for the given key that displays content.

final @NonNull Function1<@NonNull T, @NonNull NavEntry<@NonNull T>>

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

Extension functions

final void
<T extends Object> EntryProviderKt.entry(
    @NonNull EntryProviderBuilder<@NonNull ?> receiver,
    @NonNull Function1<@NonNull key, @NonNull Object> clazzContentKey,
    @NonNull Map<@NonNull String, @NonNull Object> metadata,
    @Composable @NonNull Function1<@NonNull T, Unit> content
)

Add an entry provider to the EntryProviderBuilder

final void
<T extends Object> EntryProviderKt.entry(
    @NonNull EntryProviderBuilder<@NonNull T> receiver,
    @NonNull T key,
    @NonNull Object contentKey,
    @NonNull Map<@NonNull String, @NonNull Object> metadata,
    @Composable @NonNull Function1<@NonNull T, Unit> content
)

Add an entry provider to the EntryProviderBuilder

Public constructors

EntryProviderBuilder

public <T extends Object> EntryProviderBuilder(
    @NonNull Function1<@NonNull unknownScreen, @NonNull NavEntry<@NonNull T>> fallback
)
Parameters
<T extends Object>

the type of the NavEntry key

@NonNull Function1<@NonNull unknownScreen, @NonNull NavEntry<@NonNull T>> fallback

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

Public methods

addEntryProvider

public final void <T extends Object> addEntryProvider(
    @NonNull KClass<@NonNull T> clazz,
    @NonNull Function1<@NonNull key, @NonNull Object> clazzContentKey,
    @NonNull Map<@NonNull String, @NonNull Object> metadata,
    @Composable @NonNull Function1<@NonNull T, Unit> content
)

Builds a NavEntry for the given clazz that displays content.

Parameters
<T extends Object>

the type of the key for this NavEntry

@NonNull KClass<@NonNull T> clazz

the KClass of the key for this NavEntry

@NonNull Function1<@NonNull key, @NonNull Object> clazzContentKey

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.

@NonNull Map<@NonNull String, @NonNull Object> metadata

provides information to the display

@Composable @NonNull Function1<@NonNull T, Unit> content

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

addEntryProvider

public final void <T extends Object> addEntryProvider(
    @NonNull T key,
    @NonNull Object contentKey,
    @NonNull Map<@NonNull String, @NonNull Object> metadata,
    @Composable @NonNull Function1<@NonNull T, Unit> content
)

Builds a NavEntry for the given key that displays content.

Parameters
<T extends Object>

the type of the key for this NavEntry

@NonNull T key

key for this entry

@NonNull Object contentKey

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().

@NonNull Map<@NonNull String, @NonNull Object> metadata

provides information to the display

@Composable @NonNull Function1<@NonNull T, Unit> content

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

build

Added in 1.0.0-alpha04
public final @NonNull Function1<@NonNull T, @NonNull NavEntry<@NonNull T>> build()

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

Extension functions

EntryProviderKt.entry

public final void <T extends Object> EntryProviderKt.entry(
    @NonNull EntryProviderBuilder<@NonNull ?> receiver,
    @NonNull Function1<@NonNull key, @NonNull Object> clazzContentKey,
    @NonNull Map<@NonNull String, @NonNull Object> metadata,
    @Composable @NonNull Function1<@NonNull T, Unit> content
)

Add an entry provider to the EntryProviderBuilder

Parameters
<T extends Object>

the type of the key for this NavEntry

@NonNull Function1<@NonNull key, @NonNull Object> clazzContentKey

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.

@NonNull Map<@NonNull String, @NonNull Object> metadata

provides information to the display

@Composable @NonNull Function1<@NonNull T, Unit> content

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

EntryProviderKt.entry

public final void <T extends Object> EntryProviderKt.entry(
    @NonNull EntryProviderBuilder<@NonNull T> receiver,
    @NonNull T key,
    @NonNull Object contentKey,
    @NonNull Map<@NonNull String, @NonNull Object> metadata,
    @Composable @NonNull Function1<@NonNull T, Unit> content
)

Add an entry provider to the EntryProviderBuilder

Parameters
<T extends Object>

the type of the key for this NavEntry

@NonNull T key

key for this entry

@NonNull Object contentKey

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().

@NonNull Map<@NonNull String, @NonNull Object> metadata

provides information to the display

@Composable @NonNull Function1<@NonNull T, Unit> content

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