Compose
This module is placed inside the extension-compose
and offers some helpful compose extensions for the Storage
class.
collectAsState
#
@Composable
fun <T, X> StorageSetting<T>.collectAsState(
initialValue: T? = getCached(),
mapper: (T) -> X
): State<X?>
collectAsStateNotNull
#
@Composable
fun <T> StorageSetting<T>.collectAsStateNotNull(
initialValue: T = getCached() ?: value
): State<T>
@Composable
fun <T, X> StorageSetting<T>.collectAsStateNotNull(
initialValue: T = getCached() ?: value,
mapper: (T) -> X
): State<X>