Kotlin / kotlinx.coroutines

Library support for Kotlin coroutines
Apache License 2.0
12.94k stars 1.84k forks source link

SharedFlow doesn't have same parameters as in constructor function #4194

Open Mr3zee opened 1 month ago

Mr3zee commented 1 month ago

MutableSharedFlow function has three parameters:

MutableSharedFlow interface, in turn, says in its documentation that an instance can be created using this function. SharedFlow relays on these parameters. However, they are not a part of the interfaces and are present only as parameters to the constructor function. They are part of the SharedFlowImpl class, which is internal in kotlinx.coroutines.core.

This makes it hard to properly serialize SharedFlows in the kotlinx.rpc library.

Can you, please, advise what can be done to improve this situation? We need a multiplatform approach to retrieve these parameters, however, we don't have one now

qwwdfsad commented 1 month ago

Could you please elaborate on the lifecycle of such a SharedFlow? E.g. the particular use-case how and why it is serialized and what it represents to clients etc.

dovchinnikov commented 3 weeks ago

@Mr3zee Why would you want to serialize shared flows in the first place?