diff --git a/firebase_core/_firebase_database_collection_vm/CHANGELOG.md b/firebase_core/_firebase_database_collection_vm/CHANGELOG.md index 2e2e7561..f79b31c9 100644 --- a/firebase_core/_firebase_database_collection_vm/CHANGELOG.md +++ b/firebase_core/_firebase_database_collection_vm/CHANGELOG.md @@ -1,5 +1,7 @@ -## 0.0.2+1 +## 0.0.3 +- add unionWith to sorted set to mirror Web SDK. +## 0.0.2+1 - constrain test, collection, meta dependency ## 0.0.2 diff --git a/firebase_core/_firebase_database_collection_vm/lib/src/immutable_sorted_set.dart b/firebase_core/_firebase_database_collection_vm/lib/src/immutable_sorted_set.dart index bf4e2aef..bd86d977 100644 --- a/firebase_core/_firebase_database_collection_vm/lib/src/immutable_sorted_set.dart +++ b/firebase_core/_firebase_database_collection_vm/lib/src/immutable_sorted_set.dart @@ -33,6 +33,22 @@ class ImmutableSortedSet extends Iterable { return ImmutableSortedSet._(_map.insert(entry, null)); } + ImmutableSortedSet unionWith(ImmutableSortedSet other) { + ImmutableSortedSet result = this; + + // Make sure `result` always refers to the larger one of the two sets. + if (result.length < other.length) { + result = other; + other = this; + } + + for (T elem in other) { + result = result.insert(elem); + } + + return result; + } + T get minEntry => _map.minKey; T get maxEntry => _map.maxKey; @@ -70,10 +86,7 @@ class ImmutableSortedSet extends Iterable { @override bool operator ==(Object other) => - identical(this, other) || - other is ImmutableSortedSet && - runtimeType == other.runtimeType && - _map == other._map; + identical(this, other) || other is ImmutableSortedSet && runtimeType == other.runtimeType && _map == other._map; @override int get hashCode => _map.hashCode; diff --git a/firebase_core/_firebase_database_collection_vm/pubspec.yaml b/firebase_core/_firebase_database_collection_vm/pubspec.yaml index af915ad1..494cfda9 100644 --- a/firebase_core/_firebase_database_collection_vm/pubspec.yaml +++ b/firebase_core/_firebase_database_collection_vm/pubspec.yaml @@ -1,6 +1,6 @@ name: _firebase_database_collection_vm description: For internal use of the Firestore and Realtime Database packages -version: 0.0.2+1 +version: 0.0.3 homepage: https://github.com/fluttercommunity/firebase_flutter_sdk environment: @@ -9,4 +9,6 @@ environment: dev_dependencies: test: '>=1.0.0 <2.0.0' dart_quickcheck: - git: https://github.com/long1eu/dart_quickcheck.git \ No newline at end of file + git: https://github.com/long1eu/dart_quickcheck.git + +latest_commit: a94d79a90b737dde059fc53a56ed21c22e2498ee \ No newline at end of file