create
Creates an unmanaged RealmAny
instance from a Short value.
Creates an unmanaged RealmAny
instance from an Int value.
Creates an unmanaged RealmAny
instance from a Byte value.
Creates an unmanaged RealmAny
instance from a Char value.
Creates an unmanaged RealmAny
instance from a Long value.
Creates an unmanaged RealmAny
instance from a Boolean value.
Creates an unmanaged RealmAny
instance from a String value.
Creates an unmanaged RealmAny
instance from a Float value.
Creates an unmanaged RealmAny
instance from a Double value.
Creates an unmanaged RealmAny
instance from a Decimal128 value.
Creates an unmanaged RealmAny
instance from a BsonObjectId value.
Creates an unmanaged RealmAny
instance from a ByteArray value.
Creates an unmanaged RealmAny
instance from a RealmInstant value.
Creates an unmanaged RealmAny
instance from a RealmUUID value.
Creates an unmanaged RealmAny
instance from a RealmObject value and its corresponding KClass.
Creates an unmanaged RealmAny
instance from a RealmObject value.
Creates an unmanaged RealmAny
instance from a DynamicRealmObject value.
Creates an unmanaged RealmAny
instance from a RealmList of RealmAny values.
To create a RealmAny containing a RealmList of arbitrary values wrapped in RealmAnys use the io.realm.kotlin.ext.realmAnyListOf.
A RealmList<RealmAny?>
can contain all RealmAny types, also other collection types:
class SampleObject() : RealmObject {
val realmAnyField: RealmAny? = null
}
val realmObject = copyToRealm(SampleObject())
// List can contain other collections, but only `RealmList<RealmAny>` and
// `RealmDictionary<RealmAny>`.
realmObject.realmAnyField = realmAnyListOf(
// Primitive values
1,
// Lists and dictionaries can contain other collection types
realmListOf(
realmListOf(),
realmDictionaryOf()
),
realmDictionaryOf(
"key1" to realmListOf(),
"key2" to realmDictionaryOf())
)
Creates an unmanaged RealmAny
instance from a RealmDictionary of RealmAny values.
To create a RealmAny containing a RealmDictionary of arbitrary values wrapped in RealmAnys use the io.realm.kotlin.ext.realmAnyDictionaryOf.
A RealmDictionary<RealmAny?>
can contain all RealmAny types, also other collection types:
class SampleObject() : RealmObject {
val realmAnyField: RealmAny? = null
}
val realmObject = copyToRealm(SampleObject())
// Dictionaries can contain other collections, but only `RealmList<RealmAny>` and
// `RealmDictionary<RealmAny>`.
realmObject.realmAnyField = realmAnyDictionaryOf(
"int" to 5,
// Lists and dictionaries can contain other nested collection types
"list" to realmListOf(
realmListOf(),
realmDictionaryOf()
),
"dictionary" to realmDictionaryOf(
"key1" to realmListOf(),
"key2" to realmDictionaryOf())
)