Skip to content

Commit

Permalink
Update to Core next-major
Browse files Browse the repository at this point in the history
  • Loading branch information
nirinchev committed Jan 9, 2024
1 parent ecdce26 commit d73499e
Show file tree
Hide file tree
Showing 10 changed files with 449 additions and 21 deletions.
9 changes: 7 additions & 2 deletions lib/src/collections.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,20 @@ class CollectionChanges {
final List<int> modificationsAfter;
final List<Move> moves;
final bool isCleared;
final bool isDeleted;

const CollectionChanges(this.deletions, this.insertions, this.modifications, this.modificationsAfter, this.moves, this.isCleared);
const CollectionChanges(this.deletions, this.insertions, this.modifications, this.modificationsAfter, this.moves, this.isCleared, this.isDeleted);
}

/// @nodoc
class MapChanges {
final List<String> deletions;
final List<String> insertions;
final List<String> modifications;
final bool isCleared;
final bool isDeleted;

const MapChanges(this.deletions, this.insertions, this.modifications);
const MapChanges(this.deletions, this.insertions, this.modifications, this.isCleared, this.isDeleted);
}

/// Describes the changes in a Realm collection since the last time the notification callback was invoked.
Expand Down Expand Up @@ -91,4 +94,6 @@ extension RealmCollectionChangesInternal on RealmCollectionChanges {
void keepAlive() {
_handle.keepAlive();
}

CollectionChanges get changes => _changes;
}
3 changes: 3 additions & 0 deletions lib/src/list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ class RealmListChanges<T extends Object?> extends RealmCollectionChanges {
final RealmList<T> list;

RealmListChanges._(super.handle, this.list);

/// `true` if the underlying list was deleted.
bool get isCollectionDeleted => changes.isDeleted;
}

/// @nodoc
Expand Down
6 changes: 6 additions & 0 deletions lib/src/map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,12 @@ class RealmMapChanges<T extends Object?> {

/// The keys of the map, whose corresponding values were modified in this version.
List<String> get modified => _changes.modifications;

/// `true` if the map was cleared.
bool get isCleared => _changes.isCleared;

/// `true` if the underlying map was deleted.
bool get isCollectionDeleted => _changes.isDeleted;
}

// The query operations on maps only work for maps of objects (core restriction),
Expand Down
Loading

0 comments on commit d73499e

Please sign in to comment.