From 45d6c2de8a08498448718daf5538d28240f6fbc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Sun, 11 Feb 2024 11:04:47 +0100 Subject: [PATCH] Elaborate CHANGELOG --- CHANGELOG.md | 28 ++++++++++++++++++- .../realm_dart/lib/src/native/realm_core.dart | 2 +- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 158c77106..2cea570e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,33 @@ ## vNext (TBD) ### Breaking changes -* The generated parts are now named `.realm.dart` instead of `.g.dart`. This is because the builder is now a `PartBuilder`, instead of a `SharedPartBuilder`. This implies that other builders can consume the output. +* The generated parts are now named `.realm.dart` instead of `.g.dart`. This is because the builder is now a `PartBuilder`, instead of a `SharedPartBuilder`. To migrate to this version you need to update all the part declarations to match, ie. `part 'x.g.dart` becomes `part x.realm.dart` and rerun the generator. + + This makes it easier to combine builders. Here is an example of combining with `dart_mappable`: + ```dart + import 'package:dart_mappable/dart_mappable.dart'; + import 'package:realm_dart/realm.dart'; + + part 'part_builder.realm.dart'; + part 'part_builder.mapper.dart'; + + @MappableClass() + @RealmModel() + class $Stuff with $StuffMappable { + @MappableField() + late int id; + + @override + String toString() => 'Stuff{id: $id}'; + } + + final realm = Realm(Configuration.local([Stuff.schema])); + void main(List arguments) { + final s = realm.write(() => realm.add(Stuff(1), update: true)); + print(s.toJson()); // <-- realm object as json + Realm.shutdown(); + } + ``` ### Enhancements * None diff --git a/packages/realm_dart/lib/src/native/realm_core.dart b/packages/realm_dart/lib/src/native/realm_core.dart index 48eb19565..ed0821b79 100644 --- a/packages/realm_dart/lib/src/native/realm_core.dart +++ b/packages/realm_dart/lib/src/native/realm_core.dart @@ -1735,7 +1735,7 @@ class _RealmCore { } } - static void user_change_callback(Pointer userdata, int data) { + static void user_change_callback(Object userdata, int data) { final controller = userdata as UserNotificationsController; controller.onUserChanged();