https://kotlinlang.org logo
Title
b

bnn

10/10/2019, 11:12 AM
onReceiveOrNull
defined on
ReceiveChannel
interface is now deprecated, and
onReceiveOrNull
extension function defined on
ReceiveChannel
is now
ExperimentalCoroutinesApi
. I'm trying to use extension version of onReceiveOrNull but I can't. Is there anything wrong?
I'm using
kotlinx-coroutines-core:1.3.2
m

molikuner

10/10/2019, 9:16 PM
As real non extension functions are preferred over extension functions you can't call it with that name. You could do:
import kotlinx.coroutines.channels.onRecieveOrNull as onRecieveOrNullExtension
And use
onRecieveOrNullExtension
instead of
onRecieveOrNull
b

bnn

10/10/2019, 11:50 PM
Oh, it's Kotlin's grammatical rule,,,, Thanks! It works fine for me!