requireNotNull

fun <T : Any> Provider<T?>.requireNotNull(message: String = "Required value was null."): Provider<T>

Creates and returns a new Provider that throws an IllegalArgumentException with message if the value is null.

The returned provider will only be stored in a WeakReference in the parent provider (this).


inline fun <T : Any> Provider<T?>.requireNotNull(crossinline message: () -> String): Provider<T>

Creates and returns a new Provider that throws an IllegalArgumentException with a message generated by message if the value is null.

message should be a pure function.

The returned provider will only be stored in a WeakReference in the parent provider (this).