withNotNull

inline fun <T, R> withNotNull(receiver: T?, scopeBlock: T.() -> R): R?

Runs scopeBlock with receiver as its own receiver, only if receiver is non-null — a let-style scope function whose Kotlin contract makes the smart-cast explicit at the call site. Used, for instance, by TextFieldTileSchema.keyboardOptions() to build a KeyboardOptions only when the schema's own nested keyboardOptions field is non-null.

Return

the result of scopeBlock, or null if receiver was null.

Parameters

receiver

the value to check.

scopeBlock

run with receiver as its receiver, at most once.