🌈 Create new beautiful Compose Gradients with our new wesite ->
Class

ActionParameters

Action parameters, used to pass information to an Action.

Source set: Android
public abstract class ActionParameters internal constructor()

Action parameters, used to pass information to an Action.

Construct action parameters using actionParametersOf or mutableActionParametersOf, with typed key-value pairs. The Key class enforces typing of the values inserted.

Functions

contains

Source set: Android
public abstract operator fun <T : Any> contains(key: Key<T>): Boolean

Returns true if the Parameters set contains the given Key.

Parameters

key the key to check for

get

Source set: Android
public abstract operator fun <T : Any> get(key: Key<T>): T?

Get a parameter with a key. If the key is not set, returns null.

Parameters

T the type of the parameter
key the key for the parameter

Throws: ClassCastException

if there is something stored with the same name as key but it cannot be cast to T

getOrDefault

Source set: Android
public abstract fun <T : Any> getOrDefault(key: Key<T>, defaultValue: @UnsafeVariance T): T

Get a parameter with a key. If the key is not set, returns the provided default value.

Parameters

T the type of the parameter
key the key for the parameter
defaultValue the default value to return if key is missing

Throws: ClassCastException

if there is something stored with the same name as key but it cannot be cast to T

asMap

Source set: Android
public abstract fun asMap(): Map<Key<out Any>, Any>

Retrieves a map of all key value pairs. The map is unmodifiable, and attempts to mutate it will throw runtime exceptions.

Return

a map of all parameters in this Parameters

isEmpty

Source set: Android
public abstract fun isEmpty(): Boolean

Returns whether there are any keys stored in the parameters.

Members

Key

Source set: Android
public class Key<T : Any>(public val name: String)

Key for ActionParameters values. Type T is the type of the associated value. T must be a primitive or Parcelable type. The Key.name must be unique, keys with the same name are considered equal.

Functions

to

Source set: Android
public infix fun to(value: T): Pair<T>

Infix function to create a Parameters.Pair.

Parameters

value the value this key should point to

equals

Source set: Android
override fun equals(other: Any?): Boolean

hashCode

Source set: Android
override fun hashCode(): Int

toString

Source set: Android
override fun toString(): String

Pair

Source set: Android
public class Pair<T : Any> internal constructor(internal val key: Key<T>, internal val value: T)

Key Value pairs for Parameters. Type T is the type of the value. Pairs must have unique keys, or they will be considered equal.

Create this using the infix function to.

Functions

equals

Source set: Android
override fun equals(other: Any?): Boolean

hashCode

Source set: Android
override fun hashCode(): Int

toString

Source set: Android
override fun toString(): String