Hi, i use a object class at the moment that gives ...
# multiplatform
s
Hi, i use a object class at the moment that gives a stateflow back as parameter of the object. Now i get the Threadlocal warning. I cant use ThreadLocal because then the stateflow wouldnt be updated. if i just dont use the @ThreadLocal then everything works fine. Can i suppress it with some @Suppress or are there other problems that can happen because i dont use @ThreadLocal? I am on Kotlin 1.9.10 Would be nice if someone knows anything about it. Thanks in advance 🙂
r
Use a class instantiated once instead? And inject it with Koin or something
c
What's the code?
s
What do you mean by the code @CLOVIS? This will cause the problem: Object CustomClass { Private var _stateflow: MutableStateFlow<String> = MutableStateFlow(„first“) Val stateflow: StateFlow<String> = _stateflow.asStateFlow() } @ribesg mhm would be an option. I tried using koin, but in the end It hasn’t worked so I stopped trying to use di in the kmm project. Had hoped that there is maybe just a suppress for this warnings 😅 I mean it works pretty good without threadlocal.