ScreenWithMutation
data class ScreenWithMutation<T, R>(val screen: ScreenState<T>, val mutation: MutationState<R> = MutationState.Idle, val outboxPending: Int = 0, val isSyncing: Boolean = false)
The whole state of a screen that both DISPLAYS data and MUTATES it — the read ScreenState and the write MutationState in one snapshot, plus the offline-sync status (outboxPending count + isSyncing) so a "3 pending · syncing…" banner needs no extra plumbing.
The capstone over the read (screenStateStream) and write (submitFlow) halves: a ViewModel exposes one Flow<ScreenWithMutation<T, R>> instead of juggling several.
Constructors
Link copied to clipboard
constructor(screen: ScreenState<T>, mutation: MutationState<R> = MutationState.Idle, outboxPending: Int = 0, isSyncing: Boolean = false)