https://kotlinlang.org logo
#flow
Title
# flow
m

Marc Knaup

02/17/2021, 7:22 PM
Is there an easy way to wrap a
MutableStateFlow
so that I can do something with new values before they are sent downstream? E.g.
Copy code
fun <Value: Any> persistedFlow(key: String, serializer: KSerializer<Value>): MutableStateFlow<Value?> =
	save(MutableStateFlow(value = load(key, serializer)), key, serializer)
How would I implement
save
? According to the docs:
The
MutableStateFlow
interface is not stable for inheritance in 3rd party libraries (…)
g

gildor

03/02/2021, 12:08 PM
Well, if you need stable api in your library you cannot implement MutableStateFlow
4 Views