SavedStateReader


value public final class SavedStateReader


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

See also
read

Summary

Public methods

final boolean

Checks if the SavedState contains the specified key.

final boolean

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

final int

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

final @NonNull String

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

final @NonNull IBinder

Retrieves an IBinder object associated with the specified key.

final IBinder

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

final boolean

Retrieves a Boolean value associated with the specified key.

final @NonNull boolean[]

Retrieves a BooleanArray value associated with the specified key.

final boolean[]

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

final Boolean

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

final char

Retrieves a Char value associated with the specified key.

final @NonNull char[]

Retrieves a CharArray value associated with the specified key.

final char[]

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

final Character

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

final @NonNull CharSequence

Retrieves a CharSequence value associated with the specified key.

final @NonNull CharSequence[]

Retrieves a CharArray value associated with the specified key.

final CharSequence[]

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

final @NonNull List<@NonNull CharSequence>

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

final List<@NonNull CharSequence>

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

final CharSequence

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

final double

Retrieves a Double value associated with the specified key.

final @NonNull double[]

Retrieves a DoubleArray value associated with the specified key.

final double[]

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

final Double

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

final float

Retrieves a Float value associated with the specified key.

final @NonNull float[]

Retrieves a FloatArray value associated with the specified key.

final float[]

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

final Float

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

final int

Retrieves an Int value associated with the specified key.

final @NonNull int[]

Retrieves a IntArray value associated with the specified key.

final int[]

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

final @NonNull List<@NonNull Integer>

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

final List<@NonNull Integer>

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

final Integer

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

final @NonNull T

Retrieves a Serializable object associated with the specified key.

final @NonNull T
<T extends Serializable> getJavaSerializable(
    @NonNull String key,
    @NonNull KClass<@NonNull T> serializableClass
)

Retrieves a Serializable object associated with the specified key.

final T

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

final T
<T extends Serializable> getJavaSerializableOrNull(
    @NonNull String key,
    @NonNull KClass<@NonNull T> serializableClass
)

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

final long

Retrieves an Long value associated with the specified key.

final @NonNull long[]

Retrieves a LongArray value associated with the specified key.

final long[]

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

final Long

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

final @NonNull T
<T extends Parcelable> getParcelable(@NonNull String key)

Retrieves a Parcelable object associated with the specified key.

final @NonNull T
<T extends Parcelable> getParcelable(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

Retrieves a Parcelable object associated with the specified key.

final @NonNull T[]

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

final @NonNull T[]
<T extends Parcelable> getParcelableArray(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

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

final T[]

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

final T[]
<T extends Parcelable> getParcelableArrayOrNull(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

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

final @NonNull List<@NonNull T>

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

final @NonNull List<@NonNull T>
<T extends Parcelable> getParcelableList(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

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

final List<@NonNull T>

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

final List<@NonNull T>
<T extends Parcelable> getParcelableListOrNull(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

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

final T

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

final T
<T extends Parcelable> getParcelableOrNull(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

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

final @NonNull SavedState

Retrieves a SavedState object associated with the specified key.

final @NonNull SavedState[]

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

final SavedState[]

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

final @NonNull List<@NonNull SavedState>

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

final List<@NonNull SavedState>

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

final SavedState

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

final @NonNull Size

Retrieves a Size object associated with the specified key.

final @NonNull SizeF

Retrieves a SizeF object associated with the specified key.

final SizeF

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

final Size

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

final @NonNull SparseArray<@NonNull T>

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

final @NonNull SparseArray<@NonNull T>
<T extends Parcelable> getSparseParcelableArray(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

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

final SparseArray<@NonNull T>

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

final SparseArray<@NonNull T>
<T extends Parcelable> getSparseParcelableArrayOrNull(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

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

final @NonNull String

Retrieves a String value associated with the specified key.

final @NonNull String[]

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

final String[]

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

final @NonNull List<@NonNull String>

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

final List<@NonNull String>

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

final String

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

final boolean

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

final boolean

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

final int

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

final @NonNull Map<@NonNull StringObject>

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

Public methods

contains

Added in 1.3.0-alpha10
public final boolean contains(@NonNull String key)

Checks if the SavedState contains the specified key.

Parameters
@NonNull String key

The key to check for.

Returns
boolean

true if the SavedState contains the key, false otherwise.

contentDeepEquals

public final boolean contentDeepEquals(@NonNull SavedState other)

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
@NonNull SavedState other

the object to compare deeply with this.

Returns
boolean

true if the two are deeply equal, false otherwise.

contentDeepHashCode

Added in 1.3.0-alpha10
public final int contentDeepHashCode()

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

Added in 1.3.0-alpha10
public final @NonNull String contentDeepToString()

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

Added in 1.3.0-alpha10
public final @NonNull IBinder getBinder(@NonNull String key)

Retrieves an IBinder object associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull 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

Added in 1.3.0-alpha10
public final IBinder getBinderOrNull(@NonNull String key)

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

getBoolean

Added in 1.3.0-alpha10
public final boolean getBoolean(@NonNull String key)

Retrieves a Boolean value associated with the specified key.

Parameters
@NonNull String key

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

Added in 1.3.0-alpha10
public final @NonNull boolean[] getBooleanArray(@NonNull String key)

Retrieves a BooleanArray value associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull boolean[]

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

if associated value has wrong type.

getBooleanArrayOrNull

Added in 1.3.0-alpha10
public final boolean[] getBooleanArrayOrNull(@NonNull String key)

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

getBooleanOrNull

Added in 1.3.0-alpha10
public final Boolean getBooleanOrNull(@NonNull String key)

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

getChar

Added in 1.3.0-alpha10
public final char getChar(@NonNull String key)

Retrieves a Char value associated with the specified key.

Parameters
@NonNull String key

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

Added in 1.3.0-alpha10
public final @NonNull char[] getCharArray(@NonNull String key)

Retrieves a CharArray value associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull char[]

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

if associated value has wrong type.

getCharArrayOrNull

Added in 1.3.0-alpha10
public final char[] getCharArrayOrNull(@NonNull String key)

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

getCharOrNull

Added in 1.3.0-alpha10
public final Character getCharOrNull(@NonNull String key)

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

getCharSequence

Added in 1.3.0-alpha10
public final @NonNull CharSequence getCharSequence(@NonNull String key)

Retrieves a CharSequence value associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull 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

Added in 1.3.0-alpha10
public final @NonNull CharSequence[] getCharSequenceArray(@NonNull String key)

Retrieves a CharArray value associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull 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

Added in 1.3.0-alpha10
public final CharSequence[] getCharSequenceArrayOrNull(@NonNull String key)

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

getCharSequenceList

Added in 1.3.0-alpha10
public final @NonNull List<@NonNull CharSequencegetCharSequenceList(@NonNull String key)

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

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull List<@NonNull 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

Added in 1.3.0-alpha10
public final List<@NonNull CharSequencegetCharSequenceListOrNull(@NonNull String key)

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

getCharSequenceOrNull

Added in 1.3.0-alpha10
public final CharSequence getCharSequenceOrNull(@NonNull String key)

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

getDouble

Added in 1.3.0-alpha10
public final double getDouble(@NonNull String key)

Retrieves a Double value associated with the specified key.

Parameters
@NonNull String key

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

Added in 1.3.0-alpha10
public final @NonNull double[] getDoubleArray(@NonNull String key)

Retrieves a DoubleArray value associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull double[]

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

if associated value has wrong type.

getDoubleArrayOrNull

Added in 1.3.0-alpha10
public final double[] getDoubleArrayOrNull(@NonNull String key)

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

getDoubleOrNull

Added in 1.3.0-alpha10
public final Double getDoubleOrNull(@NonNull String key)

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

getFloat

Added in 1.3.0-alpha10
public final float getFloat(@NonNull String key)

Retrieves a Float value associated with the specified key.

Parameters
@NonNull String key

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

Added in 1.3.0-alpha10
public final @NonNull float[] getFloatArray(@NonNull String key)

Retrieves a FloatArray value associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull float[]

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

if associated value has wrong type.

getFloatArrayOrNull

Added in 1.3.0-alpha10
public final float[] getFloatArrayOrNull(@NonNull String key)

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

getFloatOrNull

Added in 1.3.0-alpha10
public final Float getFloatOrNull(@NonNull String key)

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

getInt

Added in 1.3.0-alpha10
public final int getInt(@NonNull String key)

Retrieves an Int value associated with the specified key.

Parameters
@NonNull String key

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

Added in 1.3.0-alpha10
public final @NonNull int[] getIntArray(@NonNull String key)

Retrieves a IntArray value associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull int[]

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

if associated value has wrong type.

getIntArrayOrNull

Added in 1.3.0-alpha10
public final int[] getIntArrayOrNull(@NonNull String key)

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

getIntList

Added in 1.3.0-alpha10
public final @NonNull List<@NonNull IntegergetIntList(@NonNull String key)

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

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull List<@NonNull Integer>

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

if associated value has wrong type.

getIntListOrNull

Added in 1.3.0-alpha10
public final List<@NonNull IntegergetIntListOrNull(@NonNull String key)

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

getIntOrNull

Added in 1.3.0-alpha10
public final Integer getIntOrNull(@NonNull String key)

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

getJavaSerializable

public final @NonNull T <T extends Serializable> getJavaSerializable(@NonNull String key)

Retrieves a Serializable object associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull 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

Added in 1.3.0-alpha10
public final @NonNull T <T extends Serializable> getJavaSerializable(
    @NonNull String key,
    @NonNull KClass<@NonNull T> serializableClass
)

Retrieves a Serializable object associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull KClass<@NonNull T> serializableClass

The type of the object expected

Returns
@NonNull 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

public final T <T extends Serializable> getJavaSerializableOrNull(@NonNull String key)

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

getJavaSerializableOrNull

Added in 1.3.0-alpha10
public final T <T extends Serializable> getJavaSerializableOrNull(
    @NonNull String key,
    @NonNull KClass<@NonNull T> serializableClass
)

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

getLong

Added in 1.3.0-alpha10
public final long getLong(@NonNull String key)

Retrieves an Long value associated with the specified key.

Parameters
@NonNull String key

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

Added in 1.3.0-alpha10
public final @NonNull long[] getLongArray(@NonNull String key)

Retrieves a LongArray value associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull long[]

The value associated with the key.

Throws
kotlin.IllegalArgumentException

If the key is not found.

kotlin.IllegalArgumentException

if associated value has wrong type.

getLongArrayOrNull

Added in 1.3.0-alpha10
public final long[] getLongArrayOrNull(@NonNull String key)

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

getLongOrNull

Added in 1.3.0-alpha10
public final Long getLongOrNull(@NonNull String key)

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

getParcelable

public final @NonNull T <T extends Parcelable> getParcelable(@NonNull String key)

Retrieves a Parcelable object associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull 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

Added in 1.3.0-alpha10
public final @NonNull T <T extends Parcelable> getParcelable(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

Retrieves a Parcelable object associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull KClass<@NonNull T> parcelableClass

The type of the object expected

Returns
@NonNull 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

public final @NonNull T[] <T extends Parcelable> getParcelableArray(@NonNull String key)

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

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull 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

Added in 1.3.0-alpha10
public final @NonNull T[] <T extends Parcelable> getParcelableArray(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

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

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull KClass<@NonNull T> parcelableClass

The type of the object expected

Returns
@NonNull 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

public final T[] <T extends Parcelable> getParcelableArrayOrNull(@NonNull String key)

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

getParcelableArrayOrNull

Added in 1.3.0-alpha10
public final T[] <T extends Parcelable> getParcelableArrayOrNull(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

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

getParcelableList

public final @NonNull List<@NonNull T> <T extends Parcelable> getParcelableList(@NonNull String key)

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

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull List<@NonNull 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

Added in 1.3.0-alpha10
public final @NonNull List<@NonNull T> <T extends Parcelable> getParcelableList(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

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

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull KClass<@NonNull T> parcelableClass

The type of the object expected

Returns
@NonNull List<@NonNull 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

public final List<@NonNull T> <T extends Parcelable> getParcelableListOrNull(@NonNull String key)

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

getParcelableListOrNull

Added in 1.3.0-alpha10
public final List<@NonNull T> <T extends Parcelable> getParcelableListOrNull(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

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

getParcelableOrNull

public final T <T extends Parcelable> getParcelableOrNull(@NonNull String key)

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

getParcelableOrNull

Added in 1.3.0-alpha10
public final T <T extends Parcelable> getParcelableOrNull(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

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

getSavedState

Added in 1.3.0-alpha10
public final @NonNull SavedState getSavedState(@NonNull String key)

Retrieves a SavedState object associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull 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

Added in 1.3.0-alpha10
public final @NonNull SavedState[] getSavedStateArray(@NonNull String key)

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

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull 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

Added in 1.3.0-alpha10
public final SavedState[] getSavedStateArrayOrNull(@NonNull String key)

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

getSavedStateList

Added in 1.3.0-alpha10
public final @NonNull List<@NonNull SavedStategetSavedStateList(@NonNull String key)

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

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull List<@NonNull 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

Added in 1.3.0-alpha10
public final List<@NonNull SavedStategetSavedStateListOrNull(@NonNull String key)

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

getSavedStateOrNull

Added in 1.3.0-alpha10
public final SavedState getSavedStateOrNull(@NonNull String key)

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

getSize

Added in 1.3.0-alpha10
public final @NonNull Size getSize(@NonNull String key)

Retrieves a Size object associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull 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

Added in 1.3.0-alpha10
public final @NonNull SizeF getSizeF(@NonNull String key)

Retrieves a SizeF object associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull 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

Added in 1.3.0-alpha10
public final SizeF getSizeFOrNull(@NonNull String key)

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

getSizeOrNull

Added in 1.3.0-alpha10
public final Size getSizeOrNull(@NonNull String key)

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

getSparseParcelableArray

public final @NonNull SparseArray<@NonNull T> <T extends Parcelable> getSparseParcelableArray(@NonNull String key)

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

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull SparseArray<@NonNull 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

Added in 1.3.0-alpha10
public final @NonNull SparseArray<@NonNull T> <T extends Parcelable> getSparseParcelableArray(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

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

Parameters
@NonNull String key

The key to retrieve the value for.

@NonNull KClass<@NonNull T> parcelableClass

The type of the object expected

Returns
@NonNull SparseArray<@NonNull 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

public final SparseArray<@NonNull T> <T extends Parcelable> getSparseParcelableArrayOrNull(@NonNull String key)

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

getSparseParcelableArrayOrNull

Added in 1.3.0-alpha10
public final SparseArray<@NonNull T> <T extends Parcelable> getSparseParcelableArrayOrNull(
    @NonNull String key,
    @NonNull KClass<@NonNull T> parcelableClass
)

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

getString

Added in 1.3.0-alpha10
public final @NonNull String getString(@NonNull String key)

Retrieves a String value associated with the specified key.

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull 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

Added in 1.3.0-alpha10
public final @NonNull String[] getStringArray(@NonNull String key)

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

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull 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

Added in 1.3.0-alpha10
public final String[] getStringArrayOrNull(@NonNull String key)

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

getStringList

Added in 1.3.0-alpha10
public final @NonNull List<@NonNull StringgetStringList(@NonNull String key)

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

Parameters
@NonNull String key

The key to retrieve the value for.

Returns
@NonNull List<@NonNull 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

Added in 1.3.0-alpha10
public final List<@NonNull StringgetStringListOrNull(@NonNull String key)

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

getStringOrNull

Added in 1.3.0-alpha10
public final String getStringOrNull(@NonNull String key)

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

isEmpty

Added in 1.3.0-alpha10
public final boolean isEmpty()

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

Returns
boolean

true if the SavedState is empty, false otherwise.

isNull

Added in 1.3.0-alpha10
public final boolean isNull(@NonNull String key)

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

Parameters
@NonNull String key

The key to check for.

Returns
boolean

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

size

Added in 1.3.0-alpha10
public final int size()

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

Returns
int

The size of the SavedState.

toMap

Added in 1.3.0-alpha10
public final @NonNull Map<@NonNull StringObjecttoMap()

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
@NonNull Map<@NonNull StringObject>

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