Colton Idle
08/25/2023, 6:47 PMColton Idle
08/25/2023, 6:48 PMJakub Syty
08/25/2023, 7:29 PMget
them. So if you need a singleton that is created right at `startKoin`call (for example if you need to do something at the application start) you need to mark it as createdAtStart
Jakub Syty
08/25/2023, 7:30 PMstartKoin
then larger applications might have some stuttering problems at start (frame drops, long startup time etc)Colton Idle
08/25/2023, 8:20 PMJacob Ras
08/25/2023, 9:58 PMget()
a class it's created. With this flag, however, it's immediately instantiated as soon as start Koin. One example of where this is useful would be a class that logs app startup time. You'd mark it as createdAtStart
and then without needing to inject it anywhere, it will run on startup. This concept is called an eager initialisation. With Dagger you'd use it in the same scenarios. Another example would be pre-loading something for performance. I use this in only one of the apps I work on, to pre-load a cache before it's ever injected anywhere. We do the load on a background scope, but it's nice to have it already kicked off on app startup since in our case all users will touch this cache in their sessions.Colton Idle
08/26/2023, 5:55 AMarnaud.giuliani
08/29/2023, 12:18 PMColton Idle
08/29/2023, 1:16 PMColton Idle
01/17/2024, 12:15 AMarnaud.giuliani
01/17/2024, 8:10 AM