getNullableValueDictionary

abstract fun <T : Any> getNullableValueDictionary(propertyName: String, clazz: KClass<T>): RealmDictionary<T?>

Returns the dictionary of nullable elements referenced by the property name as a RealmDictionary.

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

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

// Retrieve a dictionary of nullable ints from a 'nullableIntDictionary' property
dynamicRealmObject.getNullableValueDictionary("nullableIntDictionary", Int::class)

// Retrieve a dictionary of non-nullable ints from a 'intDictionary' property
dynamicRealmObject.getValueDictionary("intDictionary", Int::class)

// Retrieve a dictionary of objects from an `objectDictionary' property
// Object dictionaries are ALWAYS nullable
dynamicRealmObject.getObjectDictionary("objectDictionary", DynamicRealmObject::class)

Return

the referenced RealmDictionary

Parameters

propertyName

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

clazz

the Kotlin class of the dictionary element type.

T

the type of the dictionary element type.

Throws

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