I use a shared ViewModel in an Android/iOS app. I ...
# multiplatform
l
I use a shared ViewModel in an Android/iOS app. I inject some dependencies there with Koin. However when trying to write data to the
apiConfigRepository
dependency I get the exception `mutation attempt of frozen ApiConfigurationRepositoryImpl@1edb608`:
Copy code
class TVShowsSharedViewModelImpl(
    dispatcher: CoroutineDispatcher = Dispatchers.Main
) : TVShowsSharedViewModel,
    KoinComponent {

    val coroutineScope = CoroutineScope(dispatcher)

    val tmdbApi: TmdbApi by inject()
    val apiConfigRepository: ApiConfigurationRepository by inject()

    init {
        coroutineScope.launch {
            val apiConfig = tmdbApi.getConfiguration()
            with(apiConfigRepository) {
                imageBaseUrl = apiConfig.images.baseUrl
                updateBackdropSizes(apiConfig.images.backdropSizes)
            }
        }
    }
}
l
l
Thank you, I will try that. 🙏