Pat Teruel
09/22/2021, 7:43 AMobject ClientWrapper{
val api = PetApi()
}
While it did work, now we have some adjustments on our own client. It needs to have a Bearer Token. In order to that, I need to call the setBearerToken()
function inside the api
.
But I can’t do that when it’s wrapped in an immutable class. So I had to instantiate the Api object everytime I need to set the bearer token. The thing is, it’s not working at all in iOS. It gives me off an error of “Frozen Mutability Exception”, it’s kind of pointing out on the lazy variables. While I get the gist of the problem, what I’m not sure of is how to do some workarounds to solve this problem. Putting a @ThreadLocal
on the client wrapper itself doesn’t seem to work at all. Has anyone ever solved this?
I’m seeing certain youtrack posts that it will not be solved until Kotlin changes some memory stuff, but I’m not sure. I hope someone can help me figure this out. Thank you.Michal Harakal
09/22/2021, 12:55 PM