ifNotNull

inline fun <T : Any> ERROR CLASS: Symbol not found for Modifier.ifNotNull(value: T?, chain: ERROR CLASS: Symbol not found for Modifier.(T) -> ERROR CLASS: Symbol not found for Modifier): ERROR CLASS: Symbol not found for Modifier

Modifier to make it easy to conditionally add a modifier based on value nullability

Box(
modifier = Modifier.fillMaxWidth()
.ifNotNull(errorMetadata) { errorData -> background(errorData.color) }
.padding(16.dp)
) {...}

Parameters

value

decide if the chain is added or not to the modifier chain

chain

the modifier(s) to apply when value is not null