getObjectList

abstract fun getObjectList(propertyName: String): RealmList<out DynamicRealmObject>

Returns the list of objects referenced by the property name as a RealmList.

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

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

// Retrieve a list of nullable ints from a 'nullableIntList' property
dynamicRealmObject.getNullableValueList("nullableIntList", Int::class)

// Retrieve a list of non-nullable ints from a 'intList' property
dynamicRealmObject.getValueList("intList", Int::class)

// Retrieve a list of objects from an `objectList' property
// Object lists are ALWAYS non-nullable
dynamicRealmObject.getObjectList("objectList", DynamicRealmObject::class)

Return

the referenced RealmList

Parameters

propertyName

the name of the list property to retrieve the list for.

Throws

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