abstract fun resetReplayCache()

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.

On a MutableStateFlow, which always contains a single value, this function is not supported, and throws an UnsupportedOperationException. To reset a MutableStateFlow to an initial value, just update its value.

This method is thread-safe and can be safely invoked from concurrent coroutines without external synchronization.

Note: This is an experimental api. This function may be removed or renamed in the future.


common source
Link copied to clipboard