isNullable
Whether the descriptor describes a nullable type. Returns true
if associated serializer can serialize/deserialize nullable elements of the described type.
Example:
@Serializable
class User(val name: String, val alias: String?)
val userDescriptor = User.serializer().descriptor
userDescriptor.isNullable // Returns false
userDescriptor.getElementDescriptor(0).isNullable // Returns false
userDescriptor.getElementDescriptor(1).isNullable // Returns true
Content copied to clipboard