Define a Repository Interface
Expose data needs without leaking HTTP details.
What a Repository Is
A repository is the single doorway your apps walk through to get data, hiding where that data actually comes from.
Start With an Interface
Define the repository as a Kotlin interface first, so callers depend on a contract instead of a concrete class.
interface UserRepository {
suspend fun getUser(id: String): User
}All lessons in this course
- Define a Repository Interface
- Wrap the API Behind the Repository
- Map DTOs to Domain Models
- Expose Results as Flow