Group Group Group Group Group Group Group Group Group

Dependency Injection with Hilt: Fundamentals |

In this dependency injection course, learn how to apply an awesome new library called Hilt, to build dependency graphs, and inject dependencies into Android components in an automatic and lifecycle-aware way, without having to write a ton of boilerplate code, you had to write with Dagger.

This is a companion discussion topic for the original entry at
1 Like

Hi, Thanks for the course! enjoyed it - right to the point.

I was wondering why did you design the login/register API calls to be non-suspending.
why did you prefer callbacks for these methods?

interface RemoteApiService {

  fun registerUser(@Body request: UserDataRequest): Call<RegisterResponse>

  suspend fun getNotes(): GetTasksResponse

  fun loginUser(@Body request: UserDataRequest): Call<LoginResponse>

  suspend fun getMyProfile(): UserProfileResponse

  suspend fun completeTask(@Query("id") noteId: String): CompleteNoteResponse

  suspend fun addTask(@Body request: AddTaskRequest): Task

  suspend fun deleteNote(@Query("id") noteId: String): DeleteNoteResponse


1 Like

Hey @tomer !

I think that in the process of working on the project we updated most of the API calls for another course/project, but these two were left off as basic functions to showcase the difference between the two approaches!

In any way, doing it right would be having all of the functions as suspend for consistency. :]

1 Like

Learned a LOT. Thank you.