Inject into ViewModels & Repos
Resolve dependencies cleanly throughout the app.
From Declared to Used
You registered dependencies and started Koin. Now comes the payoff: injecting those objects into your repositories and view models without building them by hand.
Constructor Injection First
The cleanest style is constructor injection: list what a class needs as parameters, and Koin fills them via get() in the module.
single { UserRepository(api = get()) }All lessons in this course
- Declare a Shared Koin Module
- single vs factory Scopes
- Start Koin on Android & iOS
- Inject into ViewModels & Repos