Updated on 2026-08-14

This commit is contained in:
Tangem 2025-01-09 17:01:38 +03:00
parent f5e56b881e
commit 60dde15698
3 changed files with 24 additions and 6 deletions

View file

@ -2,6 +2,7 @@ package com.tangem.datasource.local.datastore
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.update
/**
* Runtime store
@ -16,6 +17,8 @@ interface RuntimeStateStore<T> {
/** Store [value] */
suspend fun store(value: T)
suspend fun update(function: (T) -> T)
companion object {
/**
@ -32,6 +35,10 @@ interface RuntimeStateStore<T> {
override suspend fun store(value: T) {
flow.value = value
}
override suspend fun update(function: (T) -> T) {
flow.update(function)
}
}
}
}