API reference
API reference
Select your platform
No SDKs available
No versions available

withDataModelOrNull Function

Modifiers: final
Access the DataModel if available, or null otherwise.
Safe version of null.withDataModel that returns null if no DataModel is set.
Example:
val result = withDataModelOrNull { dm ->
    // Operations that may fail gracefully
}

Signature

inline fun <R> withDataModelOrNull(block: (DataModel) -> R): R?

Parameters

block: Function1
A lambda that receives the DataModel.

Returns

The value returned by the block, or null if no DataModel is set.
Did you find this page helpful?