https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
koin
  • a

    aipok

    06/14/2021, 10:09 AM
    Good day, Following are 2 weird behaviors I noticed after 3.1.0 migration… Just things that you need to be consider while declaring your classes in module… 1. Handling default parameters in the constructor are not supported/ not working, so you must declare body explicitly every time you want to declare some class which has
    default parameter
    . Otherwise you will get
    Declaration parameter error
    . 2. Second pain point I got is related to the
    parametersOf
    /
    params
    and class casting. Especially that causes error if you pass an implementation of the interface, but interface is expected as a parameter for the instance constructor. In this case
    params.[get|get<Something>|getOrNull]
    will not work, because expected
    T::class
    isn’t the
    parameter::class
    . The only way I get it to work is to use
    params[0]
    . I assume all this could lead to confusion for people and also will take some time without a proper guidance in which case what should be used. Added samples to thread as well for illustration purposes 👀 It could be also that I misunderstood the concept or something… in this case I would appreciate if someone who aware could give highlight for me.
    a
    • 2
    • 3
  • s

    Slackbot

    06/14/2021, 10:27 AM
    This message was deleted.
    a
    i
    • 3
    • 3
  • a

    alorma

    06/15/2021, 4:10 PM
    HI! Trying to use koin
    3.1.0
    crashes with:
    Process: <http://com.alorma.online|com.alorma.online>, PID: 27063
        java.lang.NoSuchMethodError: No interface method startReplaceableGroup(ILjava/lang/String;)V in class Landroidx/compose/runtime/Composer; or its super classes (declaration of 'androidx.compose.runtime.Composer' appears in /data/app/~~Blc5lbQ6ufp-BTmeiEZj8Q==/com.alorma.online-HU9SyBXOt-tG6CArGrkzLg==/base.apk)
    j
    a
    • 3
    • 29
  • a

    Abhishek Dewan

    06/18/2021, 5:53 PM
    Hi folks. I just upgraded to 3.1.0 and I am noticing something odd. The following code fails to compile
    viewModel(override = true) { SearchScreenViewModel(get()) }
    I am guessing that the override param was removed from the viewModel call (release notes mention something about it s being a global option). Could someone explain as to what that means and how would we configure something like this in the new system. On a side note the documentation for the function still mentioned override as a accepted param (most likely an oversight) but thought you might want to know 🙂
    j
    • 2
    • 2
  • r

    Rak

    06/21/2021, 8:03 AM
    Hi, where can I find info on using Koin in a KMM project?
    a
    • 2
    • 2
  • a

    arnaud.giuliani

    06/24/2021, 8:26 AM
    Koin 3.1.1 deployed - https://github.com/InsertKoinIO/koin/blob/master/CHANGELOG.md#311
    🚀 8
    r
    j
    • 3
    • 7
  • s

    Slackbot

    06/24/2021, 4:40 PM
    This message was deleted.
    a
    s
    • 3
    • 7
  • f

    Fanilog

    06/25/2021, 2:07 PM
    Hello 👋 I'm trying to retrieve the arguments in the savedStateHandle from the VM. Apparently argument passed as argument in the navcontroller can be retrieved like this. I've tried to do some thing like in this video

    https://www.youtube.com/watch?v=0z_dwBGQQWQ▾

    However the savedStatehandle is always empty?
    ➕ 2
    a
    • 2
    • 1
  • m

    Mini

    06/29/2021, 8:55 AM
    Trying to use KoinTest for instrumented compose tests. My test class implements KoinTest and I use KoinTestRule
    @get:Rule
    val koinTestRule = KoinTestRule.create {
        modules(module)
    }
    and stopKoin @After
    @After
    fun stopKoin() {
        stopKoin()
    }
    however the very first test that is run fails with
    java.lang.IllegalStateException: No Koin application found
    but the following tests run just fine. What could be the reason for this? 😞
    a
    • 2
    • 2
  • m

    Mark

    06/29/2021, 10:36 AM
    I’m in the process of upgrading from 3.0.1 to 3.1.1, and am getting runtime errors due to
    single(createdAtStart = true)
    being started more eagerly than in 3.0.1. Now it seems that such declarations are immediately invoked. Is this working as intended (i.e. 3.0.1 was faulty) or a bug in 3.1.1?
    a
    • 2
    • 7
  • r

    Rak

    06/29/2021, 3:09 PM
    I am using Firebase Remote Config and I have created a Wrapper class for use throughout my app, injected via Koin. The Firebase Remote Config singleton requires some initial setup before it can be used. Currently I do this in my Application subclass just before I start Koin, but I was wondering if there was a better way? Can Koin be told to instantiate a class immediately rather than on first use? If so, i can mov the initialization code into init() of the wrapper class.
    a
    • 2
    • 2
  • v

    Vivek Modi

    07/01/2021, 11:50 AM
    Hey i am using koin v2.2.2 in my project. In viewmodel parameter i am declare context object , it giving warning. How to prevent this
    r
    • 2
    • 12
  • l

    LG

    07/01/2021, 8:27 PM
    Hey! Im using Koin
    v.3.1
    and I have some issue with the injection of the
    SavedStateHandle
    in my ViewModel When my viewmodel is called for the first time in my Fragment, I received a new SavedStateHandle and not the one I see from the Fragment Does anyone have an idea Here’s the code: VM
    class ArticleViewModel(
            private val savedStateHandle: SavedStateHandle,
            private val useCase: ArticleUseCase) : ViewModel() {
    AppModule
    viewModel { ArticleViewModel(get(), get()) }
    a
    • 2
    • 4
  • k

    kevindmoore

    07/02/2021, 6:53 PM
    I'm having a really hard time figuring out why I get a crash getting a view model. It works the first time but not the 2nd. I am using KoinApplication and not startKoin (as this is a library)
    t
    • 2
    • 6
  • y

    Yahor

    07/04/2021, 4:03 PM
    @arnaud.giuliani Hello, could you please take a look into a closed issue? I have reproduced the crash and added the sample project. https://github.com/InsertKoinIO/koin/issues/1095
    a
    • 2
    • 3
  • n

    Nikky

    07/05/2021, 10:51 AM
    on multiplatform / js how can i initialize singles with suspend functions ?
    a
    • 2
    • 3
  • f

    Fanilog

    07/07/2021, 4:06 PM
    Is there a way to link a component (eg:Presenter injected multiple times) to a viewmodel scope ? Edit: in a full compose app
    👀 1
    a
    • 2
    • 5
  • j

    John O'Reilly

    07/09/2021, 9:22 PM
    Are there any examples of using Koin in a Jetpack Compose test (as described in https://developer.android.com/codelabs/jetpack-compose-testing) ...for example being able to inject mock dependencies?
    r
    a
    • 3
    • 5
  • n

    Nacho Ruiz Martin

    07/12/2021, 3:58 PM
    Hey! 👋 I’ve seen the way KaMPkit and John O’Reilly’s
    People in Space
    handle the Koin injection in a multiplatform project and both are pretty cool. But in the long term, you will also need a DI framework for the Swift app. I know this is a long, shot, but is there any way or future plan to include the injection on the iOS app itself using Koin? I mean, not needing another DI framework. This would make Koin super powerful in multiplatform projects. What do you think? Is it possible in any way?
    r
    • 2
    • 2
  • m

    Merseyside

    07/14/2021, 11:43 AM
    Hi! I got a question about scopes + viewModel. I have two fragments, and for both I have two scopes(smth like
    scope(qualifier = named<Fragment1>()) { ... }
    Also I want to share one viewModel between them. I found that I need t create one more scope with viewModel and link it with both fragment's scopes. Is it a good practise? Any suggestions how to do this correctly? Also they are not parent and child. It's two different fragment in navigation graph
    a
    • 2
    • 3
  • m

    Mark

    07/15/2021, 2:40 AM
    Is it recommended to replace
    GlobalContext.get()
    with
    KoinPlatformTools.defaultContext().get()
    ?
    a
    • 2
    • 1
  • m

    Marko Novakovic

    07/17/2021, 2:25 PM
    is there a way to provide dependencies of the same type and inject them all together as a list? multibindings
    m
    s
    • 3
    • 15
  • s

    Scott Kruse

    07/22/2021, 8:36 PM
    I have a component that needs to be shared by various subcomponents within ViewModel, what is the best way to accomplish this? It needs to be the same instance
    ViewModel(sharedComponent, OtherComponent(sharedComponent))
    a
    • 2
    • 5
  • c

    Christopher Porto

    07/23/2021, 10:10 PM
    Hello, how would I go about binding different implementations based on an environment variable?
    n
    p
    • 3
    • 2
  • d

    Dirk Seewald

    07/24/2021, 3:37 PM
    Is there a way of having sub applications? For example a root application and multiple sub applications that all inherit instances and modules of the root application.
    a
    • 2
    • 3
  • h

    holgerbrandl

    07/28/2021, 6:34 PM
    Hi, I've searched the docs but could not find any lead: How can I use koin from java (for interop reasons I'm using a mixed code repo)?
    smthg.getKoin().get(FooBar.class)
    does not work because the argument is not a KClass, but I have no clue how to create one from java.
    a
    • 2
    • 2
  • s

    Scott Kruse

    07/29/2021, 3:00 PM
    Thoughts on adding a lint warning / compiler warning for instances where
    ViewModel
    is instantiated via
    by inject()
    instead of
    by viewModel()
    ?
    a
    • 2
    • 1
  • n

    Nacho Ruiz Martin

    08/03/2021, 3:50 PM
    Hey 👋 Is there any way to scope a
    viewModel
    to a navigation graph using Jetpack compose navigation? I would like a
    viewModel
    to be used by several composables and get cleared and reinstantiated when the user exists -> reenters to that screen flow.
    s
    a
    • 3
    • 18
  • j

    Jgafner

    08/03/2021, 5:51 PM
    Hi I posted some questions on #koin-dev but I just found out about this channel so will post here as well, probably more appropriate: When overriding a module like in the documentation example: val myModuleA = module { single<Service> { ServiceImp() } } val myModuleB = module { single<Service> { TestServiceImp() } } // Will throw an BeanOverrideException startKoin { modules(myModuleA,myModuleB) } we see that koin create ServiceImp instance but even if we override it - any good way to avoid it ? It is a ktor-koin project and we have some scheduler in the ServiceImp init that we don’t want to start at all when just running the tests Thanks
    k
    a
    • 3
    • 3
  • a

    Adriano Rocha

    08/12/2021, 8:59 PM
    I was wondering one good thing to have on koin website is the list of projects using it, so it would be easy to encourage other projects to use it as well
    f
    • 2
    • 1
Powered by Linen
Title
a

Adriano Rocha

08/12/2021, 8:59 PM
I was wondering one good thing to have on koin website is the list of projects using it, so it would be easy to encourage other projects to use it as well
f

Fatih

09/09/2021, 7:44 PM
2 projects on prod, no issues.
View count: 4