addEntry

fun <K : NavKey> addEntry(keyClass: KClass<K>, rootKeyClass: KClass<*>, serializer: KSerializer<K>, screenFactory: () -> ActivityScreen<K>)

Registers one screen. Called from generated code only.

Re-registering the same keyClass is a no-op, so a module whose bootstrap runs twice does not duplicate entries. A different screen claiming a key that is already taken is a programming error and throws — KSP rejects that case at build time within a module, but two modules can only be caught here.

Parameters

keyClass

Runtime class of K.

rootKeyClass

Runtime class of the sealed root K belongs to.

serializer

Serializer for K.

screenFactory

Creates the screen handling K.