
From Data to UI with RequestState in Kotlin Multiplatform
Part 3 of 4 — This part builds on the ResponseResult contract from Part 2 and the HttpClient setup from Part 1 . If you're jumping in here, those two parts cover the layers this one sits on top of. In Part 2, we built a networking layer where every call returns a ResponseResult<T> . The repository knows nothing about loading state, error dialogs, or UI updates — it just makes the call and returns a typed result. Clean, testable, consistent. But the ViewModel still has to react to those results. It needs to set loading to true before the call, update state when it succeeds, show an error when it fails, and set loading to false when it's done. Across a real app with dozens of screens, this ceremony adds up fast. And if every developer handles it slightly differently, you end up with the same inconsistency problem you had in the repository layer — just one floor higher. This part solves that. We'll build RequestState — the UI-side equivalent of ResponseResult — and wire it to executeNetwo
Continue reading on Dev.to
Opens in a new tab

