single vs factory Scopes
Choose singletons versus fresh instances.
Two Ways to Build
Koin gives you two main definition keywords: single and factory. They differ in one thing, how often Koin builds the object.
single Means One Instance
A single is created once and shared everywhere. Every part of your app that asks for it receives the very same object. 🔁
single { UserRepository(get()) }All lessons in this course
- Declare a Shared Koin Module
- single vs factory Scopes
- Start Koin on Android & iOS
- Inject into ViewModels & Repos