asFlow

fun <E> Listenable<E>.asFlow(): Flow<E>(source)

Converts this Listenable into a Flow that emits events.

This extension function creates a cold Flow that will register a listener when collection starts and automatically unregister it when collection stops. The Flow will emit all events received by the listener during the collection period.

Return

A Flow that emits events of type E from this Listenable