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 object associated with the specified key.

android
IBinder?

Returns the value corresponding to the given key, or null if such a key is not present.

android
Boolean

Retrieves a Boolean value associated with the specified key.

Cmn
android
BooleanArray

Retrieves a BooleanArray value associated with the specified key.

Cmn
android
BooleanArray?

Returns the value corresponding to the given key, or null if such a key is not present.

Cmn
android
Boolean?

Returns the value corresponding to the given key, or null if such a key is not present.

Cmn
android
Char

Retrieves a Char value associated with the specified key.

Cmn
android
CharArray

Retrieves a CharArray value associated with the specified key.

Cmn
android
CharArray?

Returns the value corresponding to the given key, or null if such a key is not present.

Cmn
android
Char?

Returns the value corresponding to the given key, or null if such a key is not present.

Cmn
android
CharSequence

Retrieves a CharSequence value associated with the specified key.

Cmn
android
Array<CharSequence>

Retrieves a CharArray value associated with the specified key.

Cmn
android
Array<CharSequence>?

Returns the value corresponding to the given key, or null if such a key is not present.

Cmn
android
List<CharSequence>

Retrieves a List of elements of CharArray associated with the specified key.

Cmn
android
List<CharSequence>?

Returns the value corresponding to the given key, or null if such a key is not present.

Cmn
android
CharSequence?

Returns the value corresponding to the given key, or null if such a key is not present.

Cmn
android
Double

Retrieves a Double value associated with the specified key.

Cmn
android
DoubleArray

Retrieves a DoubleArray value associated with the specified key.

Cmn
android
DoubleArray?

Returns the value corresponding to the given key, or null if such a key is not present.

Cmn
android
Double?

Returns the value corresponding to the given key, or null if such a key is not present.

Cmn
android
Float

Retrieves a Float value associated with the specified key.

Cmn
android
FloatArray

Retrieves a FloatArray value associated with the specified key.

Cmn
android
FloatArray?

Returns the value corresponding to the given key, or null if such a key is not present.

Cmn
android
Float?

Returns the value corresponding to the given key, or null if such a key is not present.

Cmn
android
Int
getInt(key: String)

Retrieves an Int value associated with the specified key.

Cmn
android
IntArray

Retrieves a IntArray value associated with the specified key.

Cmn
android
IntArray?

Returns the value corresponding to the given key, or null if such a key is not present.

Cmn
android
List<Int>

Retrieves a List of elements of Int associated with the specified key.

Cmn
android
List<Int>?

Returns the value corresponding to the given key, or null if such a key is not present.

Cmn
android
Int?

Returns the value corresponding to the given key, or null if such a key is not present.

Cmn
android
inline T

Retrieves a Serializable object associated with the specified key.

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

Retrieves a Serializable object associated with the specified key.

android
inline T?

Returns the value corresponding to the given key, or null if such a key is not present.

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

Returns the value corresponding to the given key, or null if such a key is not present.

android
Long

Retrieves an Long value associated with the specified key.

Cmn
android
LongArray

Retrieves a LongArray value associated with the specified key.

Cmn
android
LongArray?

Returns the value corresponding to the given key, or null if such a key is not present.

Cmn
android
Long?

Returns the value corresponding to the given key, or null if such a key is not present.

Cmn
android
inline T

Retrieves a Parcelable object associated with the specified key.

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

Retrieves a Parcelable object associated with the specified key.

android
inline Array<T>

Retrieves an Array of elements of Parcelable associated with the specified key.

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

Retrieves an Array of elements of Parcelable associated with the specified key.

android
inline Array<T>?

Returns the value corresponding to the given key, or null if such a key is not present.

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

Returns the value corresponding to the given key, or throws IllegalArgumentException.

android
inline List<T>

Retrieves a List of elements of Parcelable associated with the specified key.

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

Retrieves a List of elements of Parcelable associated with the specified key.

android
inline List<T>?

Returns the value corresponding to the given key, or null if such a key is not present.

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

Returns the value corresponding to the given key, or null if such a key is not present.

android
inline T?

Returns the value corresponding to the given key, or null if such a key is not present.

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

Returns the value corresponding to the given key, or null if such a key is not present.

android
SavedState

Retrieves a SavedState object associated with the specified key.

Cmn
android
Array<SavedState>

Retrieves a Array of SavedState value associated with the specified key.

Cmn
android
Array<SavedState>?

Returns the value corresponding to the given key, or null if such a key is not present.

Cmn
android
List<SavedState>

Retrieves a List of elements of SavedState associated with the specified key.

Cmn
android
List<SavedState>?

Returns the value corresponding to the given key, or null if such a key is not present.

Cmn
android
SavedState?

Returns the value corresponding to the given key, or null if such a key is not present.

Cmn
android
Size

Retrieves a Size object associated with the specified key.

android
SizeF

Retrieves a SizeF object associated with the specified key.

android
SizeF?

Returns the value corresponding to the given key, or null if such a key is not present.

android
Size?

Returns the value corresponding to the given key, or null if such a key is not present.

android
inline SparseArray<T>

Retrieves a SparseArray of elements of Parcelable associated with the specified key.

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

Retrieves a SparseArray of elements of Parcelable associated with the specified key.

android
inline SparseArray<T>?

Returns the value corresponding to the given key, or null if such a key is not present.

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

Returns the value corresponding to the given key, or null if such a key is not present.

android
String

Retrieves a String value associated with the specified key.

Cmn
android
Array<String>

Retrieves a Array of String value associated with the specified key.

Cmn
android
Array<String>?

Returns the value corresponding to the given key, or null if such a key is not present.

Cmn
android
List<String>

Retrieves a List of elements of String associated with the specified key.

Cmn
android
List<String>?

Returns the value corresponding to the given key, or null if such a key is not present.

Cmn
android
String?

Returns the value corresponding to the given key, or null if such a key is not present.

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 object associated with the specified key.

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 has wrong type.

getBinderOrNull

fun getBinderOrNull(key: String): IBinder?

Returns the value corresponding to the given key, or null if such a key is not present.

getBoolean

fun getBoolean(key: String): Boolean

Retrieves a Boolean value associated with the specified key.

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 has wrong type.

getBooleanArray

fun getBooleanArray(key: String): BooleanArray

Retrieves a BooleanArray value associated with the specified key.

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 has wrong type.

getBooleanArrayOrNull

fun getBooleanArrayOrNull(key: String): BooleanArray?

Returns the value corresponding to the given key, or null if such a key is not present.

getBooleanOrNull

fun getBooleanOrNull(key: String): Boolean?

Returns the value corresponding to the given key, or null if such a key is not present.

getChar

fun getChar(key: String): Char

Retrieves a Char value associated with the specified key.

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 has wrong type.

getCharArray

fun getCharArray(key: String): CharArray

Retrieves a CharArray value associated with the specified key.

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 has wrong type.

getCharArrayOrNull

fun getCharArrayOrNull(key: String): CharArray?

Returns the value corresponding to the given key, or null if such a key is not present.

getCharOrNull

fun getCharOrNull(key: String): Char?

Returns the value corresponding to the given key, or null if such a key is not present.

getCharSequence

fun getCharSequence(key: String): CharSequence

Retrieves a CharSequence value associated with the specified key.

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 has wrong type.

getCharSequenceArray

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

Retrieves a CharArray value associated with the specified key.

Parameters
key: String

The key to retrieve the value for.

Returns
Array<CharSequence>

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

if associated value has wrong type.

getCharSequenceArrayOrNull

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

Returns the value corresponding to the given key, or null if such a key is not present.

getCharSequenceList

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

Retrieves a List of elements of CharArray associated with the specified key.

Parameters
key: String

The key to retrieve the value for.

Returns
List<CharSequence>

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

if associated value has wrong type.

getCharSequenceListOrNull

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

Returns the value corresponding to the given key, or null if such a key is not present.

getCharSequenceOrNull

fun getCharSequenceOrNull(key: String): CharSequence?

Returns the value corresponding to the given key, or null if such a key is not present.

getDouble

fun getDouble(key: String): Double

Retrieves a Double value associated with the specified key.

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 has wrong type.

getDoubleArray

fun getDoubleArray(key: String): DoubleArray

Retrieves a DoubleArray value associated with the specified key.

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 has wrong type.

getDoubleArrayOrNull

fun getDoubleArrayOrNull(key: String): DoubleArray?

Returns the value corresponding to the given key, or null if such a key is not present.

getDoubleOrNull

fun getDoubleOrNull(key: String): Double?

Returns the value corresponding to the given key, or null if such a key is not present.

getFloat

fun getFloat(key: String): Float

Retrieves a Float value associated with the specified key.

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 has wrong type.

getFloatArray

fun getFloatArray(key: String): FloatArray

Retrieves a FloatArray value associated with the specified key.

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 has wrong type.

getFloatArrayOrNull

fun getFloatArrayOrNull(key: String): FloatArray?

Returns the value corresponding to the given key, or null if such a key is not present.

getFloatOrNull

fun getFloatOrNull(key: String): Float?

Returns the value corresponding to the given key, or null if such a key is not present.

getInt

fun getInt(key: String): Int

Retrieves an Int value associated with the specified key.

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 has wrong type.

getIntArray

fun getIntArray(key: String): IntArray

Retrieves a IntArray value associated with the specified key.

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 has wrong type.

getIntArrayOrNull

fun getIntArrayOrNull(key: String): IntArray?

Returns the value corresponding to the given key, or null if such a key is not present.

getIntList

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

Retrieves a List of elements of Int associated with the specified key.

Parameters
key: String

The key to retrieve the value for.

Returns
List<Int>

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

if associated value has wrong type.

getIntListOrNull

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

Returns the value corresponding to the given key, or null if such a key is not present.

getIntOrNull

fun getIntOrNull(key: String): Int?

Returns the value corresponding to the given key, or null if such a key is not present.

getJavaSerializable

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

Retrieves a Serializable object associated with the specified key.

Parameters
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 has wrong type.

getJavaSerializable

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

Retrieves a Serializable object associated with the specified key.

Parameters
key: String

The key to retrieve the value for.

serializableClass: KClass<T>

The type of the object expected

Returns
T

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

if associated value has wrong type.

getJavaSerializableOrNull

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

Returns the value corresponding to the given key, or null if such a key is not present.

getJavaSerializableOrNull

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

Returns the value corresponding to the given key, or null if such a key is not present.

getLong

fun getLong(key: String): Long

Retrieves an Long value associated with the specified key.

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 has wrong type.

getLongArray

fun getLongArray(key: String): LongArray

Retrieves a LongArray value associated with the specified key.

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 has wrong type.

getLongArrayOrNull

fun getLongArrayOrNull(key: String): LongArray?

Returns the value corresponding to the given key, or null if such a key is not present.

getLongOrNull

fun getLongOrNull(key: String): Long?

Returns the value corresponding to the given key, or null if such a key is not present.

getParcelable

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

Retrieves a Parcelable object associated with the specified key.

Parameters
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 has wrong type.

getParcelable

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

Retrieves a Parcelable object associated with the specified key.

Parameters
key: String

The key to retrieve the value for.

parcelableClass: KClass<T>

The type of the object expected

Returns
T

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

if associated value has wrong type.

getParcelableArray

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

Retrieves an Array of elements of Parcelable associated with the specified key.

Parameters
key: String

The key to retrieve the value for.

Returns
Array<T>

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

if associated value has wrong type.

getParcelableArray

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

Retrieves an Array of elements of Parcelable associated with the specified key.

Parameters
key: String

The key to retrieve the value for.

parcelableClass: KClass<T>

The type of the object expected

Returns
Array<T>

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

if associated value has wrong type.

getParcelableArrayOrNull

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

Returns the value corresponding to the given key, or null if such a key is not present.

getParcelableArrayOrNull

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

Returns the value corresponding to the given key, or throws IllegalArgumentException.

getParcelableList

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

Retrieves a List of elements of Parcelable associated with the specified key.

Parameters
key: String

The key to retrieve the value for.

Returns
List<T>

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

if associated value has wrong type.

getParcelableList

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

Retrieves a List of elements of Parcelable associated with the specified key.

Parameters
key: String

The key to retrieve the value for.

parcelableClass: KClass<T>

The type of the object expected

Returns
List<T>

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

if associated value has wrong type.

getParcelableListOrNull

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

Returns the value corresponding to the given key, or null if such a key is not present.

getParcelableListOrNull

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

Returns the value corresponding to the given key, or null if such a key is not present.

getParcelableOrNull

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

Returns the value corresponding to the given key, or null if such a key is not present.

getParcelableOrNull

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

Returns the value corresponding to the given key, or null if such a key is not present.

getSavedState

fun getSavedState(key: String): SavedState

Retrieves a SavedState object associated with the specified key.

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 has wrong type.

getSavedStateArray

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

Retrieves a Array of SavedState value associated with the specified key.

Parameters
key: String

The key to retrieve the value for.

Returns
Array<SavedState>

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

if associated value has wrong type.

getSavedStateArrayOrNull

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

Returns the value corresponding to the given key, or null if such a key is not present.

getSavedStateList

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

Retrieves a List of elements of SavedState associated with the specified key.

Parameters
key: String

The key to retrieve the value for.

Returns
List<SavedState>

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

if associated value has wrong type.

getSavedStateListOrNull

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

Returns the value corresponding to the given key, or null if such a key is not present.

getSavedStateOrNull

fun getSavedStateOrNull(key: String): SavedState?

Returns the value corresponding to the given key, or null if such a key is not present.

getSize

fun getSize(key: String): Size

Retrieves a Size object associated with the specified key.

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 has wrong type.

getSizeF

fun getSizeF(key: String): SizeF

Retrieves a SizeF object associated with the specified key.

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 has wrong type.

getSizeFOrNull

fun getSizeFOrNull(key: String): SizeF?

Returns the value corresponding to the given key, or null if such a key is not present.

getSizeOrNull

fun getSizeOrNull(key: String): Size?

Returns the value corresponding to the given key, or null if such a key is not present.

getSparseParcelableArray

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

Retrieves a SparseArray of elements of Parcelable associated with the specified key.

Parameters
key: String

The key to retrieve the value for.

Returns
SparseArray<T>

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

if associated value has wrong type.

getSparseParcelableArray

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

Retrieves a SparseArray of elements of Parcelable associated with the specified key.

Parameters
key: String

The key to retrieve the value for.

parcelableClass: KClass<T>

The type of the object expected

Returns
SparseArray<T>

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

if associated value has wrong type.

getSparseParcelableArrayOrNull

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

Returns the value corresponding to the given key, or null if such a key is not present.

getSparseParcelableArrayOrNull

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

Returns the value corresponding to the given key, or null if such a key is not present.

getString

fun getString(key: String): String

Retrieves a String value associated with the specified key.

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 has wrong type.

getStringArray

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

Retrieves a Array of String value associated with the specified key.

Parameters
key: String

The key to retrieve the value for.

Returns
Array<String>

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

if associated value has wrong type.

getStringArrayOrNull

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

Returns the value corresponding to the given key, or null if such a key is not present.

getStringList

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

Retrieves a List of elements of String associated with the specified key.

Parameters
key: String

The key to retrieve the value for.

Returns
List<String>

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

if associated value has wrong type.

getStringListOrNull

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

Returns the value corresponding to the given key, or null if such a key is not present.

getStringOrNull

fun getStringOrNull(key: String): String?

Returns the value corresponding to the given key, or null if such a key is not present.

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.