inline suspend fun <T> Flow.Publisher<T>.collect(action: (T) -> Unit)

Subscribes to this Flow Publisher and performs the specified action for each received element.

If action throws an exception at some point, the subscription is cancelled, and the exception is rethrown from collect. Also, if the publisher signals an error, that error is rethrown from collect.