awaitOrNull

suspend fun <T> Deferred<T>.awaitOrNull(timeout: Duration): T?

Awaits this deferred value and returns null if timeout elapses first.

A non-positive timeout returns null without waiting. If the deferred fails, its failure is rethrown unchanged; null signals only a timeout.

Cancellation: on timeout, only the wait is cancelled, never the deferred itself. Cancellation of the calling coroutine, and cancellation of the deferred, are rethrown.

Parameters

timeout

how long to wait for the value.