cacheLatestSuccess
Caches the latest Success value and keeps emitting it instead of Loading during reloads.
This is useful for scenarios where you want to show stale data while refreshing, rather than showing a loading indicator.
Behavior:
On first Success, caches the value and emits it
On subsequent Loading, keeps emitting the cached Success (not Loading)
Error and NotStarted are always emitted as-is
Example:
// Flow: Loading -> Success(1) -> Loading -> Success(2)
// Output: Loading -> Success(1) -> Success(1) -> Success(2)
dataFlow.cacheLatestSuccess().collect { result ->
// Shows cached data during reloads
}Content copied to clipboard