SavedStateReader



An inline class that encapsulates an opaque SavedState, and provides an API for reading the platform specific state.

See also
read

Summary

Public functions

operator Boolean

Checks if the SavedState contains the specified key.

Cmn
android
Boolean

Checks if the two specified SavedState are deeply equal to one another.

Cmn
android
Int

Returns a hash code based on the "deep contents" of specified SavedState.

Cmn
android
String

Returns a string representation of the contents of this SavedState as if it is a List.

Cmn
android
IBinder

Retrieves an IBinder value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

android
IBinder?

Retrieves a IBinder value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

android
Boolean

Retrieves a Boolean value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

Cmn
android
BooleanArray

Retrieves a BooleanArray value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

Cmn
android
BooleanArray?

Retrieves a BooleanArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

Cmn
android
Boolean?

Retrieves a Boolean value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

Cmn
android
Char

Retrieves a Char value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

Cmn
android
CharArray

Retrieves a CharSequence value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

Cmn
android
CharArray?

Retrieves a CharArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

Cmn
android
Char?

Retrieves a Char value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

Cmn
android
CharSequence

Retrieves a CharSequence value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

Cmn
android
Array<CharSequence>

Retrieves an Array of CharSequence values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

Cmn
android
Array<CharSequence>?

Retrieves an Array of CharSequence values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

Cmn
android
List<CharSequence>

Retrieves a List of CharSequence values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

Cmn
android
List<CharSequence>?

Retrieves a List of CharSequence values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

Cmn
android
CharSequence?

Retrieves a CharSequence value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

Cmn
android
Double

Retrieves a Double value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

Cmn
android
DoubleArray

Retrieves a DoubleArray value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

Cmn
android
DoubleArray?

Retrieves a DoubleArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

Cmn
android
Double?

Retrieves a Double value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

Cmn
android
Float

Retrieves a Float value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

Cmn
android
FloatArray

Retrieves a FloatArray value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

Cmn
android
FloatArray?

Retrieves a FloatArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

Cmn
android
Float?

Retrieves a Float value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

Cmn
android
Int
getInt(key: String)

Retrieves an Int value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

Cmn
android
IntArray

Retrieves a IntArray value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

Cmn
android
IntArray?

Retrieves a IntArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

Cmn
android
List<Int>

Retrieves a List of String values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

Cmn
android
List<Int>?

Retrieves a List of Int values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

Cmn
android
Int?

Retrieves an Int value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

Cmn
android
inline T

Retrieves a Serializable value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

android
T
<T : Serializable> getJavaSerializable(
    key: String,
    serializableClass: KClass<T>
)

Retrieves a Serializable value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

android
inline T?

Retrieves a Serializable value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

android
T?
<T : Serializable> getJavaSerializableOrNull(
    key: String,
    serializableClass: KClass<T>
)

Retrieves a Serializable value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

android
Long

Retrieves a Long value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

Cmn
android
LongArray

Retrieves a LongArray value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

Cmn
android
LongArray?

Retrieves a LongArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

Cmn
android
Long?

Retrieves a Long value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

Cmn
android
inline T

Retrieves a Parcelable value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

android
T
<T : Parcelable> getParcelable(key: String, parcelableClass: KClass<T>)

Retrieves a Parcelable value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

android
inline Array<T>

Retrieves an Array of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

android
Array<T>
<T : Parcelable> getParcelableArray(key: String, parcelableClass: KClass<T>)

Retrieves an Array of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

android
inline Array<T>?

Retrieves an Array of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

android
Array<T>?
<T : Parcelable> getParcelableArrayOrNull(
    key: String,
    parcelableClass: KClass<T>
)

Retrieves an Array of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

android
inline List<T>

Retrieves a List of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

android
List<T>
<T : Parcelable> getParcelableList(key: String, parcelableClass: KClass<T>)

Retrieves a List of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

android
inline List<T>?

Retrieves a List of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

android
List<T>?
<T : Parcelable> getParcelableListOrNull(
    key: String,
    parcelableClass: KClass<T>
)

Retrieves a List of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

android
inline T?

Retrieves a Parcelable value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

android
T?
<T : Parcelable> getParcelableOrNull(key: String, parcelableClass: KClass<T>)

Retrieves a Parcelable value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

android
SavedState

Retrieves a SavedState value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

Cmn
android
Array<SavedState>

Retrieves an Array of SavedState values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

Cmn
android
Array<SavedState>?

Retrieves an Array of SavedState values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

Cmn
android
List<SavedState>

Retrieves a List of SavedState values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

Cmn
android
List<SavedState>?

Retrieves a List of SavedState values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

Cmn
android
SavedState?

Retrieves a SavedState value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

Cmn
android
Size

Retrieves a Size value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

android
SizeF

Retrieves a SizeF value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

android
SizeF?

Retrieves a SizeF value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

android
Size?

Retrieves a Size value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

android
inline SparseArray<T>

Retrieves a SparseArray of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

android
SparseArray<T>
<T : Parcelable> getSparseParcelableArray(
    key: String,
    parcelableClass: KClass<T>
)

Retrieves a SparseArray of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

android
inline SparseArray<T>?

Retrieves a Array of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

android
SparseArray<T>?
<T : Parcelable> getSparseParcelableArrayOrNull(
    key: String,
    parcelableClass: KClass<T>
)

Retrieves a Array of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

android
String

Retrieves a String value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

Cmn
android
Array<String>

Retrieves an Array of String values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

Cmn
android
Array<String>?

Retrieves an Array of String values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

Cmn
android
List<String>

Retrieves a List of String values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

Cmn
android
List<String>?

Retrieves a List of String values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

Cmn
android
String?

Retrieves a String value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

Cmn
android
Boolean

Checks if the SavedState is empty (contains no key-value pairs).

Cmn
android
Boolean
isNull(key: String)

Checks if the SavedState contains a null reference for the specified key.

Cmn
android
Int

Returns the number of key-value pairs in the SavedState.

Cmn
android
Map<StringAny?>

Returns a new Map containing all key-value pairs from the SavedState.

Cmn
android

Public functions

contains

operator fun contains(key: String): Boolean

Checks if the SavedState contains the specified key.

Parameters
key: String

The key to check for.

Returns
Boolean

true if the SavedState contains the key, false otherwise.

contentDeepEquals

fun contentDeepEquals(other: SavedState): Boolean

Checks if the two specified SavedState are deeply equal to one another.

Two SavedState are considered deeply equal if they have the same size, and elements at corresponding keys are deeply equal. That is, if two corresponding elements are nested SavedState, they are also compared deeply.

If any of SavedState contains itself on any nesting level the behavior is undefined.

Parameters
other: SavedState

the object to compare deeply with this.

Returns
Boolean

true if the two are deeply equal, false otherwise.

contentDeepHashCode

fun contentDeepHashCode(): Int

Returns a hash code based on the "deep contents" of specified SavedState. If the SavedState contains other SavedState as elements, the hash code is based on their contents and so on.

The computation of the hash code returned is as if the SavedState is a List. Nested SavedState are treated as lists too.

If any of SavedState contains itself on any nesting level the behavior is undefined.

Returns
Int

a deep-content-based hash code for SavedState.

contentDeepToString

fun contentDeepToString(): String

Returns a string representation of the contents of this SavedState as if it is a List. Nested SavedState are treated as lists too.

If any of SavedState contains itself on any nesting level that reference is rendered as "[...]" to prevent recursion.

getBinder

fun getBinder(key: String): IBinder

Retrieves an IBinder value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
IBinder

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getBinderOrNull

fun getBinderOrNull(key: String): IBinder?

Retrieves a IBinder value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
IBinder?

The value associated with the key, or null if no valid value is found.

getBoolean

fun getBoolean(key: String): Boolean

Retrieves a Boolean value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
Boolean

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getBooleanArray

fun getBooleanArray(key: String): BooleanArray

Retrieves a BooleanArray value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
BooleanArray

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getBooleanArrayOrNull

fun getBooleanArrayOrNull(key: String): BooleanArray?

Retrieves a BooleanArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
BooleanArray?

The value associated with the key, or null if no valid value is found.

getBooleanOrNull

fun getBooleanOrNull(key: String): Boolean?

Retrieves a Boolean value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Note: This method returns a nullable primitive, causing auto-boxing on JVM targets.

Parameters
key: String

The key to retrieve the value for.

Returns
Boolean?

The value associated with the key, or null if no valid value is found.

getChar

fun getChar(key: String): Char

Retrieves a Char value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
Char

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getCharArray

fun getCharArray(key: String): CharArray

Retrieves a CharSequence value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
CharArray

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getCharArrayOrNull

fun getCharArrayOrNull(key: String): CharArray?

Retrieves a CharArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
CharArray?

The value associated with the key, or null if no valid value is found.

getCharOrNull

fun getCharOrNull(key: String): Char?

Retrieves a Char value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Note: This method returns a nullable primitive, causing auto-boxing on JVM targets.

Parameters
key: String

The key to retrieve the value for.

Returns
Char?

The value associated with the key, or null if no valid value is found.

getCharSequence

fun getCharSequence(key: String): CharSequence

Retrieves a CharSequence value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
CharSequence

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getCharSequenceArray

fun getCharSequenceArray(key: String): Array<CharSequence>

Retrieves an Array of CharSequence values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the values for.

Returns
Array<CharSequence>

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getCharSequenceArrayOrNull

fun getCharSequenceArrayOrNull(key: String): Array<CharSequence>?

Retrieves an Array of CharSequence values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
Array<CharSequence>?

The values associated with the key, or null if no valid value is found.

getCharSequenceList

fun getCharSequenceList(key: String): List<CharSequence>

Retrieves a List of CharSequence values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the values for.

Returns
List<CharSequence>

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getCharSequenceListOrNull

fun getCharSequenceListOrNull(key: String): List<CharSequence>?

Retrieves a List of CharSequence values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
List<CharSequence>?

The values associated with the key, or null if no valid value is found.

getCharSequenceOrNull

fun getCharSequenceOrNull(key: String): CharSequence?

Retrieves a CharSequence value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Note: This method returns a nullable primitive, causing auto-boxing on JVM targets.

Parameters
key: String

The key to retrieve the value for.

Returns
CharSequence?

The value associated with the key, or null if no valid value is found.

getDouble

fun getDouble(key: String): Double

Retrieves a Double value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
Double

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getDoubleArray

fun getDoubleArray(key: String): DoubleArray

Retrieves a DoubleArray value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
DoubleArray

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getDoubleArrayOrNull

fun getDoubleArrayOrNull(key: String): DoubleArray?

Retrieves a DoubleArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
DoubleArray?

The value associated with the key, or null if no valid value is found.

getDoubleOrNull

fun getDoubleOrNull(key: String): Double?

Retrieves a Double value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Note: This method returns a nullable primitive, causing auto-boxing on JVM targets.

Parameters
key: String

The key to retrieve the value for.

Returns
Double?

The value associated with the key, or null if no valid value is found.

getFloat

fun getFloat(key: String): Float

Retrieves a Float value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
Float

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getFloatArray

fun getFloatArray(key: String): FloatArray

Retrieves a FloatArray value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
FloatArray

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getFloatArrayOrNull

fun getFloatArrayOrNull(key: String): FloatArray?

Retrieves a FloatArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
FloatArray?

The value associated with the key, or null if no valid value is found.

getFloatOrNull

fun getFloatOrNull(key: String): Float?

Retrieves a Float value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Note: This method returns a nullable primitive, causing auto-boxing on JVM targets.

Parameters
key: String

The key to retrieve the value for.

Returns
Float?

The value associated with the key, or null if no valid value is found.

getInt

fun getInt(key: String): Int

Retrieves an Int value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
Int

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getIntArray

fun getIntArray(key: String): IntArray

Retrieves a IntArray value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
IntArray

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getIntArrayOrNull

fun getIntArrayOrNull(key: String): IntArray?

Retrieves a IntArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
IntArray?

The value associated with the key, or null if no valid value is found.

getIntList

fun getIntList(key: String): List<Int>

Retrieves a List of String values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the values for.

Returns
List<Int>

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getIntListOrNull

fun getIntListOrNull(key: String): List<Int>?

Retrieves a List of Int values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
List<Int>?

The values associated with the key, or null if no valid value is found.

getIntOrNull

fun getIntOrNull(key: String): Int?

Retrieves an Int value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Note: This method returns a nullable primitive, causing auto-boxing on JVM targets.

Parameters
key: String

The key to retrieve the value for.

Returns
Int?

The value associated with the key, or null if no valid value is found.

getJavaSerializable

inline fun <T : Serializable> getJavaSerializable(key: String): T

Retrieves a Serializable value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
<T : Serializable>

The expected type of the value.

key: String

The key to retrieve the value for.

Returns
T

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getJavaSerializable

fun <T : Serializable> getJavaSerializable(
    key: String,
    serializableClass: KClass<T>
): T

Retrieves a Serializable value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

serializableClass: KClass<T>

The expected type of the value.

Returns
T

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getJavaSerializableOrNull

inline fun <T : Serializable> getJavaSerializableOrNull(key: String): T?

Retrieves a Serializable value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
<T : Serializable>

The expected type of the value.

key: String

The key to retrieve the value for.

Returns
T?

The value associated with the key, or null if no valid value is found.

getJavaSerializableOrNull

fun <T : Serializable> getJavaSerializableOrNull(
    key: String,
    serializableClass: KClass<T>
): T?

Retrieves a Serializable value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

serializableClass: KClass<T>

The expected type of the value.

Returns
T?

The value associated with the key, or null if no valid value is found.

getLong

fun getLong(key: String): Long

Retrieves a Long value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
Long

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getLongArray

fun getLongArray(key: String): LongArray

Retrieves a LongArray value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
LongArray

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getLongArrayOrNull

fun getLongArrayOrNull(key: String): LongArray?

Retrieves a LongArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
LongArray?

The value associated with the key, or null if no valid value is found.

getLongOrNull

fun getLongOrNull(key: String): Long?

Retrieves a Long value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Note: This method returns a nullable primitive, causing auto-boxing on JVM targets.

Parameters
key: String

The key to retrieve the value for.

Returns
Long?

The value associated with the key, or null if no valid value is found.

getParcelable

inline fun <T : Parcelable> getParcelable(key: String): T

Retrieves a Parcelable value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
<T : Parcelable>

The expected type of the value.

key: String

The key to retrieve the value for.

Returns
T

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getParcelable

fun <T : Parcelable> getParcelable(key: String, parcelableClass: KClass<T>): T

Retrieves a Parcelable value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

parcelableClass: KClass<T>

The expected type of the value.

Returns
T

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getParcelableArray

inline fun <T : Parcelable> getParcelableArray(key: String): Array<T>

Retrieves an Array of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
<T : Parcelable>

The expected type of the values.

key: String

The key to retrieve the values for.

Returns
Array<T>

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getParcelableArray

fun <T : Parcelable> getParcelableArray(key: String, parcelableClass: KClass<T>): Array<T>

Retrieves an Array of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the values for.

parcelableClass: KClass<T>

The expected type of the values.

Returns
Array<T>

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getParcelableArrayOrNull

inline fun <T : Parcelable> getParcelableArrayOrNull(key: String): Array<T>?

Retrieves an Array of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
<T : Parcelable>

The expected type of the values.

key: String

The key to retrieve the values for.

Returns
Array<T>?

The values associated with the key, or null if no valid value is found.

getParcelableArrayOrNull

fun <T : Parcelable> getParcelableArrayOrNull(
    key: String,
    parcelableClass: KClass<T>
): Array<T>?

Retrieves an Array of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the values for.

parcelableClass: KClass<T>

The expected type of the values.

Returns
Array<T>?

The values associated with the key, or null if no valid value is found.

getParcelableList

inline fun <T : Parcelable> getParcelableList(key: String): List<T>

Retrieves a List of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
<T : Parcelable>

The expected type of the values.

key: String

The key to retrieve the values for.

Returns
List<T>

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getParcelableList

fun <T : Parcelable> getParcelableList(key: String, parcelableClass: KClass<T>): List<T>

Retrieves a List of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the values for.

parcelableClass: KClass<T>

The expected type of the values.

Returns
List<T>

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getParcelableListOrNull

inline fun <T : Parcelable> getParcelableListOrNull(key: String): List<T>?

Retrieves a List of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
<T : Parcelable>

The expected type of the values.

key: String

The key to retrieve the values for.

Returns
List<T>?

The value associated with the key, or null if no valid value is found.

getParcelableListOrNull

fun <T : Parcelable> getParcelableListOrNull(
    key: String,
    parcelableClass: KClass<T>
): List<T>?

Retrieves a List of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the values for.

parcelableClass: KClass<T>

The expected type of the values.

Returns
List<T>?

The values associated with the key, or null if no valid value is found.

getParcelableOrNull

inline fun <T : Parcelable> getParcelableOrNull(key: String): T?

Retrieves a Parcelable value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
<T : Parcelable>

The expected type of the value.

key: String

The key to retrieve the value for.

Returns
T?

The value associated with the key, or null if no valid value is found.

getParcelableOrNull

fun <T : Parcelable> getParcelableOrNull(key: String, parcelableClass: KClass<T>): T?

Retrieves a Parcelable value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

parcelableClass: KClass<T>

The expected type of the value.

Returns
T?

The value associated with the key, or null if no valid value is found.

getSavedState

fun getSavedState(key: String): SavedState

Retrieves a SavedState value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
SavedState

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getSavedStateArray

fun getSavedStateArray(key: String): Array<SavedState>

Retrieves an Array of SavedState values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the values for.

Returns
Array<SavedState>

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getSavedStateArrayOrNull

fun getSavedStateArrayOrNull(key: String): Array<SavedState>?

Retrieves an Array of SavedState values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the values for.

Returns
Array<SavedState>?

The values associated with the key, or null if no valid value is found.

getSavedStateList

fun getSavedStateList(key: String): List<SavedState>

Retrieves a List of SavedState values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the values for.

Returns
List<SavedState>

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getSavedStateListOrNull

fun getSavedStateListOrNull(key: String): List<SavedState>?

Retrieves a List of SavedState values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
List<SavedState>?

The values associated with the key, or null if no valid value is found.

getSavedStateOrNull

fun getSavedStateOrNull(key: String): SavedState?

Retrieves a SavedState value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
SavedState?

The value associated with the key, or null if no valid value is found.

getSize

fun getSize(key: String): Size

Retrieves a Size value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
Size

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getSizeF

fun getSizeF(key: String): SizeF

Retrieves a SizeF value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
SizeF

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getSizeFOrNull

fun getSizeFOrNull(key: String): SizeF?

Retrieves a SizeF value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
SizeF?

The value associated with the key, or null if no valid value is found.

getSizeOrNull

fun getSizeOrNull(key: String): Size?

Retrieves a Size value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
Size?

The value associated with the key, or null if no valid value is found.

getSparseParcelableArray

inline fun <T : Parcelable> getSparseParcelableArray(key: String): SparseArray<T>

Retrieves a SparseArray of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
<T : Parcelable>

The expected type of the values.

key: String

The key to retrieve the values for.

Returns
SparseArray<T>

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getSparseParcelableArray

fun <T : Parcelable> getSparseParcelableArray(
    key: String,
    parcelableClass: KClass<T>
): SparseArray<T>

Retrieves a SparseArray of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the values for.

parcelableClass: KClass<T>

The expected type of the values.

Returns
SparseArray<T>

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getSparseParcelableArrayOrNull

inline fun <T : Parcelable> getSparseParcelableArrayOrNull(key: String): SparseArray<T>?

Retrieves a Array of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
<T : Parcelable>

The expected type of the values.

key: String

The key to retrieve the values for.

Returns
SparseArray<T>?

The values associated with the key, or null if no valid value is found.

getSparseParcelableArrayOrNull

fun <T : Parcelable> getSparseParcelableArrayOrNull(
    key: String,
    parcelableClass: KClass<T>
): SparseArray<T>?

Retrieves a Array of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the values for.

parcelableClass: KClass<T>

The expected type of the values.

Returns
SparseArray<T>?

The values associated with the key, or null if no valid value is found.

getString

fun getString(key: String): String

Retrieves a String value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
String

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getStringArray

fun getStringArray(key: String): Array<String>

Retrieves an Array of String values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the values for.

Returns
Array<String>

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getStringArrayOrNull

fun getStringArrayOrNull(key: String): Array<String>?

Retrieves an Array of String values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
Array<String>?

The values associated with the key, or null if no valid value is found.

getStringList

fun getStringList(key: String): List<String>

Retrieves a List of String values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the values for.

Returns
List<String>

The values associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

If associated value is null.

kotlin.IllegalArgumentException

if associated value has wrong type.

getStringListOrNull

fun getStringListOrNull(key: String): List<String>?

Retrieves a List of String values associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
List<String>?

The values associated with the key, or null if no valid value is found.

getStringOrNull

fun getStringOrNull(key: String): String?

Retrieves a String value associated with the specified key, or null if this SavedState does not contain a valid value for the key.

More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.

Parameters
key: String

The key to retrieve the value for.

Returns
String?

The value associated with the key, or null if no valid value is found.

isEmpty

fun isEmpty(): Boolean

Checks if the SavedState is empty (contains no key-value pairs).

Returns
Boolean

true if the SavedState is empty, false otherwise.

isNull

fun isNull(key: String): Boolean

Checks if the SavedState contains a null reference for the specified key.

Parameters
key: String

The key to check for.

Returns
Boolean

true if the SavedState contains a null reference for the key, false otherwise.

size

fun size(): Int

Returns the number of key-value pairs in the SavedState.

Returns
Int

The size of the SavedState.

toMap

fun toMap(): Map<StringAny?>

Returns a new Map containing all key-value pairs from the SavedState.

The returned Map does not preserve the entry iteration order of the SavedState.

IMPORTANT: All values will be copied by reference, and values within the SavedState that are also a SavedState will NOT be converted to a Map.

Returns
Map<StringAny?>

A Map containing all key-value pairs from the SavedState.