takeOrNull

open fun <T : Any> takeOrNull(key: AttributeKey<T>): T?

Removes an attribute with the specified key and returns its current value, returns null if an attribute doesn't exist