public interface SemanticsPropertyProvider
Read-only view of semantics properties.
SemanticsConfiguration implements this interface. SemanticsNode.unmergedConfig and SemanticsNode.mergedConfig return it so that hosts can read semantics without mutating them.
Properties
accessibilityExtraKeys
public val accessibilityExtraKeys: Set<SemanticsPropertyKey<*>>
Keys in this provider whose SemanticsPropertyKey.accessibilityExtraKey is non-null.
Hosts expose these values as accessibility extras. Returns an empty set if there are none.
isMergingSemanticsOfDescendants
public val isMergingSemanticsOfDescendants: Boolean
Whether this configuration declares that it merges the semantics of its descendants (Modifier.semantics(mergeDescendants = true)).
This is the declared value only. SemanticsNode.isMergingSemanticsOfDescendants is true only when this value is true and the node was created with SemanticsNode.mergingEnabled.
Functions
get
public operator fun <T> get(key: SemanticsPropertyKey<T>): T
Returns the value for key, or throws IllegalStateException if not set.
Parameters
| key | Property key to retrieve. |
Return
Value associated with key.
Throws: IllegalStateException
if key is not present.
getOrElse
public fun <T> getOrElse(key: SemanticsPropertyKey<T>, defaultValue: () -> T): T
Returns the value for key, or runs defaultValue if not set.
Parameters
| key | Property key to retrieve. |
| defaultValue | Fallback supplier run when key is not present. |
Return
Value associated with key, or the result of defaultValue.
getOrElseNullable
public fun <T> getOrElseNullable(key: SemanticsPropertyKey<T>, defaultValue: () -> T?): T?
Returns the value for key, or runs defaultValue if not set.
Parameters
| key | Property key to retrieve. |
| defaultValue | Fallback supplier run when key is not present. |
Return
Value associated with key, or the result of defaultValue.
contains
public operator fun <T> contains(key: SemanticsPropertyKey<T>): Boolean
Returns whether key is present in this provider.
Parameters
| key | Property key to check. |
Return
true if key is present, false otherwise.
forEachProperty
public fun forEachProperty(action: (key: SemanticsPropertyKey<*>, value: Any?) -> Unit)
Invokes action for each property key and value in this provider.
Parameters
| action | Callback invoked with each SemanticsPropertyKey and its associated value. |
anyProperty
public fun anyProperty(
predicate: (key: SemanticsPropertyKey<*>, value: Any?) -> Boolean
): Boolean
Returns true if at least one property in this provider matches predicate. Stops at the first match.
Parameters
| predicate | Predicate invoked with each SemanticsPropertyKey and its associated value. |