0Pricing
Kotlin Multiplatform Academy · Lesson

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

  1. Define a Repository Interface
  2. Wrap the API Behind the Repository
  3. Map DTOs to Domain Models
  4. Expose Results as Flow
← Back to Kotlin Multiplatform Academy