Updated on 2026-08-14

This commit is contained in:
Tangem 2025-01-20 10:12:18 +03:00
commit 780686645b
17 changed files with 70 additions and 35 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)
}
}
}
}