require

inline fun <T> Provider<T>.require(crossinline condition: (T) -> Boolean, crossinline message: (T) -> String): Provider<T>

Creates and returns a new Provider that throws an IllegalArgumentException with a message generated by message if condition fails.

condition and message should be pure functions.

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