---
title: "Discussion on \"Retrofit with MVVM in Jetpack Compose\" | Hashnode"
description: "Discussion on \"Retrofit with MVVM in Jetpack Compose\". We will build simple app using jsonplaceholderAPI for this project and use Retrofit library with MVVM in JetPack Compose.\n\n💡\nIf you are looking for Jetpack Compose ROOMDB Setup with Flow, DI and MVVM : Article : Compose MVVM RoomDB with Flow and DI\n..."
url: "https://hashnode.com/posts/retrofit-with-mvvm-in-jetpack-compose/63dceb874b9f4e3be47a0a72"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Retrofit with MVVM in Jetpack Compose](https://saurabhjadhavblogs.com/retrofit-with-mvvm-in-jetpack-compose?utm_source=hashnode&utm_medium=feed)

We will build simple app using jsonplaceholderAPI for this project and use Retrofit library with MVVM in JetPack Compose. 💡 If you are looking for Jetpack Compose ROOMDB Setup with Flow, DI and MVVM : Article : Compose MVVM RoomDB with Flow and DI ...

Feb 3, 2023 · 6 min read · saurabhjadhavblogs.com  
Updated Dec 11, 2023  
Read the article

-   [#jetpack-compose](https://hashnode.com/tag/jetpack-compose)
-   [#kotlin](https://hashnode.com/tag/kotlin)
-   [#android](https://hashnode.com/tag/android)

## Written by

[saurabh jadhav](https://hashnode.com/@saurabhjadhav)

@saurabhjadhav

  
[View profile](https://hashnode.com/@saurabhjadhav)

Android and AI developer

## Responses 1

Markdown supported · ⌘↵ to post

[Nathan Meade](https://hashnode.com/@nathanmeade)

[Apr 3, 2023](https://hashnode.com/posts/retrofit-with-mvvm-in-jetpack-compose/63dceb874b9f4e3be47a0a72/comment/642af853351232fa62945479)

Why not wrap the getPosts function return type with a Retrofit Response to check for a successful response from ApiService?

[saurabh jadhav](https://hashnode.com/@saurabhjadhav)

[May 17, 2023](https://hashnode.com/posts/retrofit-with-mvvm-in-jetpack-compose/63dceb874b9f4e3be47a0a72/comment/642af853351232fa62945479#reply-6464ac18bb615ac11d996485)

Thank you for your suggestion! In this specific case, the response handling is already implemented within the getPost() function of the MainViewModel. The Flow<List<Post>> returned by mainRepository.getPost() allows us to handle success and error scenarios using the collect operator. Therefore, explicitly wrapping the return type with Response<List<Post>> may not be necessary in this context. Nonetheless, I appreciate your input and consideration.
