koin-viewmodel-scoping-traps

Installation
SKILL.md

View-model wiring traps in a runtime container

A container resolves by type at the moment of the call. A view model has a lifetime the platform owns. Every trap below is those two facts disagreeing, and none of them fails at compile time.

The base class as a service locator

// adapted — injected property renamed, body trimmed
abstract class BaseViewModel :
    ViewModel(),
    KoinComponent {
    protected val mediaHandler: MediaPlayerHandler by inject<MediaPlayerHandler>()
    // shared logging, toast, loading-dialog state …
}
Installs
2
GitHub Stars
35
First Seen
6 days ago
koin-viewmodel-scoping-traps — maxrave-dev/kotlin-footguns