set

expect operator fun <T> set(key: String, value: T?)

Associate the given value with the key. On Android, the value must have a type that could be stored in android.os.Bundle. On other platforms, the value can be of any type.

This also sets values for any active StateFlows.

Parameters

key

a key used to associate with the given value.

value

object of any type that can be accepted by Bundle.

Throws

value cannot be saved in saved state

actual operator fun <T> set(key: String, value: T?)