collectAsState

fun <T> collectAsState(key: Preferences.Key<T>, default: T): State<T>

Collects the the value of key as a state.

Author

Arnau Mora

Since

20220829

Return

An state that gets updated with new values if set to the preference.

See also

Parameters

key

The preferences key to observe.

default

The value to return if no value is stored at key, and before the stored value is fetched.