Skip to content

Coroutine Scope in MapState references Dispatchers.Main #7

@lsrom

Description

@lsrom

Currently, ovh.plrapps.mapcompose.ui.state.MapState creates coroutine scope like this: CoroutineScope(SupervisorJob() + Dispatchers.Main) but Dispatchers.Main is not present on desktop so it forces dependency on some coroutine library that provides it, which kotlinx.coroutines.Dispatchers documentation tells me should javafx, but that doesn't work for me. All this could be avoided if the MapState took coroutine scope as it's parameter, avoiding any direct references to Dispatchers.Main. I haven't tested it, but it should resolve the issue.

I am willing to submit pull request if you think this solution is acceptable. I am just trying to run this in multiplatform project and this seems to be a show stopper for now.

This is the error I get btw:

Module with the Main dispatcher is missing. Add dependency providing the Main dispatcher, e.g. 'kotlinx-coroutines-android' and ensure it has the same version as 'kotlinx-coroutines-core'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions