MutableSharedFlow
A mutable SharedFlow that provides functions to emit values to the flow. An instance of MutableSharedFlow
with the given configuration parameters can be created using MutableSharedFlow(...)
constructor function.
See the SharedFlow documentation for details on shared flows.
MutableSharedFlow
is a SharedFlow that also provides the abilities to emit a value, to tryEmit without suspension if possible, to track the subscriptionCount, and to resetReplayCache.
Concurrency
All methods of shared flow are thread-safe and can be safely invoked from concurrent coroutines without external synchronization.
Not stable for inheritance
The MutableSharedFlow
interface is not stable for inheritance in 3rd party libraries, as new methods might be added to this interface in the future, but is stable for use. Use the MutableSharedFlow(...)
constructor function to create an implementation.
Inheritors
Properties
Functions
Represents this mutable shared flow as a read-only shared flow.
Resets the replayCache of this shared flow to an empty state. New subscribers will be receiving only the values that were emitted after this call, while old subscribers will still be receiving previously buffered values. To reset a shared flow to an initial value, emit the value after this call.