Cannot use kotlin coroutines Flow api

Answered

When I try to use coroutines Flow api in a plugin development project, I get a compilation error "kotlin compiler error: Unresolved reference: consumeAsFlow".

The version of coroutines I added to the project is implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3'

A minimal sample project to reproduce the case is here https://github.com/Buckstabue/TestCoroutinesPlugin

I guess it's because the gradle idea plugin always uses a version of kotlin bundled in a target idea version. If so, can I override the bundled kotlin version? If it's impossible, then could you please make build fail earlier with an error like "Version of kotlin cannot be overridden in plugin development"

1 comment
Comment actions Permalink

Hi! Kotlin coroutines are bundled into Intellij SDK. You can track this issue in gradle-intellij-plugin github.

1

Please sign in to leave a comment.