offer

open fun offer(element: E): Boolean (source)

Deprecated: DeprecationLevel.WARNING

Deprecated offer method.

This method was deprecated in the favour of trySend. It has proven itself as the most error-prone method in Channel API:

NB Automatic migration provides best-effort for the user experience, but requires removal or adjusting of the code that relied on the exception handling. The complete replacement has a more verbose form:

channel.trySend(element)
    .onClosed { throw it ?: ClosedSendChannelException("Channel was closed normally") }
    .isSuccess

See https://github.com/Kotlin/kotlinx.coroutines/issues/974 for more context.