getPolymorphicElement

Platform and version requirements: JVM (1.3), JS (1.3), Native (1.3)
@ExperimentalStdlibApi fun <E : Element> Element.getPolymorphicElement(
    key: Key<E>
): E?

Returns the current element if it is associated with the given key in a polymorphic manner or null otherwise. This method returns non-null value if either Element.key is equal to the given key or if the key is associated with Element.key via AbstractCoroutineContextKey. See AbstractCoroutineContextKey for the example of usage.

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.coroutines/get-polymorphic-element.html