persistChanges
fun <T> MutableState<T>.persistChanges(scope: CoroutineScope, currentValue: () -> T, onPersist: suspend (T) -> Unit, onError: (Throwable, T) -> Unit = { _, latest -> value = latest })(source)
Persists changes emitted by a MutableState using the provided onPersist callback.
The helper observes state changes, skips the initial value, and invokes onError when a persistence failure occurs (defaulting to restoring the last known value).