Extension of Value class #389
Replies: 1 comment 1 reply
-
Thanks for raising! Unfortunately, adding more operators for It is advised (and you also mentioned this) to use As of extension for MVIKotlin |
Beta Was this translation helpful? Give feedback.
-
Background
With the usage of
Value
it is possible to avoid direct dependency on coroutines / Reaktive. However,Value
comes with some limitations since the implementation is not as extensive as coroutines or Reaktive.One of the limitations I have faced so far is the combination of multiple
Value
s in order to get a single observable. This leads either to a custom function that replicates the basic idea of coroutine'scombine
or Reaktive'scombineLatest
function, or introduce direct dependency to coroutines or Reaktive by replacingValue
withFlow
orObservable
.Another extension function I had to add to my projects is the conversion of
Store.states
toValue
in order to consume state updates from MVIKotlin in Decompose. This might be a very "specific" library use case, but then I started wondering ifValue
has to be part of Decompose and is not just a Decompose extension library or internal class.With that said, I think that it is not necessary to remove
Value
or limit its scope, but a few more operations might come in handy.Discussion Topic
I would like to discuss and maybe collect additional ideas for extending the
Value
class if that makes sense.One extension The extension I had in mind so far is a
combine
function that allows merging multipleValue
instance into one. Even this extension might be not necessary if there are dependency-specific extensions (like convertingFlow
toValue
orObservable
toValue
) where the merging can happen prior to the conversion toValue
with the library-specific implementation.Beta Was this translation helpful? Give feedback.
All reactions