You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,9 @@
1
1
## vNext (TBD)
2
2
3
3
### Enhancements
4
+
* Added support for creating and storing a RealmObject using the `Realm.dynamic` API: `realm.dynamic.create("Person", primaryKey: 123)`. (PR [#1669](https://github.com/realm/realm-dart/pull/1669))
5
+
* Added support for setting properties on a RealmObject using the dynamic API: `obj.dynamic.set("name", "Peter")`. (PR [#1669](https://github.com/realm/realm-dart/pull/1669))
6
+
* Listening for `.changes` on a dynamic object (obtained via the `realm.dynamic` API) no longer throws. (Issue [#1668](https://github.com/realm/realm-dart/issues/1668))
4
7
* Nested collections have full support for automatic client reset. (Core 14.7.0)
final prop = accessor.metadata._propertyKeys[name];
@@ -864,8 +883,15 @@ class DynamicRealmObject {
864
883
// If the user passed in a type argument, we should validate its nullability; if they invoked
865
884
// the method without a type arg, we don't
866
885
if (T!=_typeOf<RealmValue>() &&T!=_typeOf<Object?>() && prop.isNullable !=nullisT) {
867
-
throwRealmException(
868
-
"Property '$name' on class '${accessor.metadata.schema.name}' is ${prop.isNullable ? 'nullable' : 'required'} but the generic argument passed to get<T> is $T.");
886
+
if (relaxedNullability && prop.isNullable) {
887
+
// We're relaxing nullability requirements when setting a property - in that case, we accept
888
+
// a non-null generic type argument, even if the property is nullable to allow users to invoke
889
+
// .set without a generic argument (i.e. have the compiler infer the generic based on the value
890
+
// argument).
891
+
} else {
892
+
throwRealmException(
893
+
"Property '$name' on class '${accessor.metadata.schema.name}' is ${prop.isNullable ? 'nullable' : 'required'} but the generic argument supplied is $T.");
0 commit comments