Skip to content

Add koinGet() composable and deprecate koinInject() for naming consistency#2423

Open
saadkhalidkhan wants to merge 1 commit into
InsertKoinIO:mainfrom
saadkhalidkhan:fix/koin-get-naming-2405
Open

Add koinGet() composable and deprecate koinInject() for naming consistency#2423
saadkhalidkhan wants to merge 1 commit into
InsertKoinIO:mainfrom
saadkhalidkhan:fix/koin-get-naming-2405

Conversation

@saadkhalidkhan

@saadkhalidkhan saadkhalidkhan commented May 25, 2026

Copy link
Copy Markdown

Summary

  • Add koinGet() composable functions as the correctly-named alternative to koinInject()
  • Deprecate koinInject() with @Deprecated + ReplaceWith for easy IDE migration
  • Update Compose docs to use koinGet()

Rationale

In Koin core:

  • KoinComponent.get() / Scope.get() = eager resolution, returns T
  • KoinComponent.inject() / Scope.inject() = lazy resolution, returns Lazy<T>

In Compose, koinInject() calls Scope.get() (eager) but the name suggests lazy resolution.
koinGet() aligns the Compose API naming with core Koin conventions.

Fixes #2405

Test plan

  • koinGet() functions mirror all three overloads of koinInject()
  • Deprecated koinInject() delegates to koinGet() (no behavior change)
  • Built :compose:koin-compose:compileDebugKotlinAndroid successfully
  • Updated compose docs to reference koinGet()

…tency

koinInject() uses Scope.get() (eager resolution) under the hood, but the name implies lazy resolution like Scope.inject(). This adds koinGet() as the correctly-named alternative and deprecates koinInject() with a ReplaceWith migration.

Fixes InsertKoinIOgh-2405
@saadkhalidkhan saadkhalidkhan force-pushed the fix/koin-get-naming-2405 branch from 262b8b9 to e284f2f Compare May 25, 2026 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

org.koin.compose.koinInject has inconsistent naming with Scope functions

1 participant