Target filter
Search Kotlin docs
  • Back
  • Tealium Prism Kotlin SDK Reference
core-ktx/com.tealium.prism.core.ktx/asFlow

asFlow

fun <T> Subscribable<T>.asFlow(): Flow<T>

Converts this Subscribable into a cold Flow.

Each call to Flow.collect triggers a new, independent subscription to this Subscribable. Emissions from the Subscribable are forwarded to the Flow collector on whatever thread the Subscribable emits on. Use kotlinx.coroutines.flow.flowOn downstream to switch the context in which collection occurs.

The subscription is disposed automatically when:

  • The Subscribable calls Observer.onComplete, which closes the flow normally, or

  • The collector's coroutine is canceled, which disposes the upstream subscription.

Generated by Dokka
(c) Tealium 2026