getObject

abstract fun getObject(propertyName: String): DynamicRealmObject?

Returns the value of an object property.

The class argument must be the KClass of the RealmStorageType for the property.

The following snippet outlines the different functions available for the different value types:

// Retrieve a nullable int from a 'nullableIntField' property
dynamicRealmObject.getNullableValue("nullableIntField", Int::class)

// Retrieve a non-nullable int from an 'intField' property
dynamicRealmObject.getValue("intField", Int::class)

// Retrieve an object from an `objectField' property
dynamicRealmObject.getObject("objectField", DynamicRealmObject::class)

Return

the RealmList value.

Parameters

propertyName

the name of the property to retrieve the value for.

Throws

if the class doesn't contain a field with the specific name, if clazz doesn't match the property's RealmStorageType.kClass or if trying to retrieve collection properties.