Add support for `cloud_firestore: ^4.14.0`
Closed this issue ยท 5 comments
putnokiabel commented
Looks like when the latest version of this plugin is used in combination with cloud_firestore: ^4.14.0
, it no longer works as it's missing implementations for AggregateQuery.count
, AggregateQuerySnapshot.getAverage
etc. leading to errors like:
./.pub-cache/hosted/pub.dev/fake_cloud_firestore-2.4.6/lib/src/mock_query.dart:20:7: Error: The non-abstract class 'MockQuery'
is missing implementations for these members:
- Query.aggregate
Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.
class MockQuery<T extends Object?> extends FakeQueryWithParent<T> {
^^^^^^^^^
../.pub-cache/hosted/pub.dev/cloud_firestore-4.14.0/lib/src/query.dart:198:18: Context: 'Query.aggregate' is defined here.
AggregateQuery aggregate(
^^^^^^^^^
../.pub-cache/hosted/pub.dev/fake_cloud_firestore-2.4.6/lib/src/mock_collection_reference.dart:16:7: Error: The non-abstract
class 'MockCollectionReference' is missing implementations for these members:
- Query.aggregate
Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.
class MockCollectionReference<T extends Object?> extends MockQuery<T>
^^^^^^^^^^^^^^^^^^^^^^^
../.pub-cache/hosted/pub.dev/cloud_firestore-4.14.0/lib/src/query.dart:198:18: Context: 'Query.aggregate' is defined here.
AggregateQuery aggregate(
^^^^^^^^^
../.pub-cache/hosted/pub.dev/fake_cloud_firestore-2.4.6/lib/src/fake_aggregate_query.dart:5:7: Error: The non-abstract class
'FakeAggregateQuery' is missing implementations for these members:
- AggregateQuery.count
Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.
class FakeAggregateQuery implements AggregateQuery {
^^^^^^^^^^^^^^^^^^
../.pub-cache/hosted/pub.dev/cloud_firestore-4.14.0/lib/src/aggregate_query.dart:29:18: Context: 'AggregateQuery.count' is
defined here.
AggregateQuery count() {
^^^^^
../.pub-cache/hosted/pub.dev/fake_cloud_firestore-2.4.6/lib/src/fake_aggregate_query_snapshot.dart:3:7: Error: The non-abstract
class 'FakeAggregateQuerySnapshot' is missing implementations for these members:
- AggregateQuerySnapshot.getAverage
- AggregateQuerySnapshot.getSum
Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.
class FakeAggregateQuerySnapshot implements AggregateQuerySnapshot {
^^^^^^^^^^^^^^^^^^^^^^^^^^
../.pub-cache/hosted/pub.dev/cloud_firestore-4.14.0/lib/src/aggregate_query_snapshot.dart:25:11: Context:
'AggregateQuerySnapshot.getAverage' is defined here.
double? getAverage(String field) => _delegate.getAverage(field);
^^^^^^^^^^
../.pub-cache/hosted/pub.dev/cloud_firestore-4.14.0/lib/src/aggregate_query_snapshot.dart:22:11: Context:
'AggregateQuerySnapshot.getSum' is defined here.
double? getSum(String field) => _delegate.getSum(field);
atn832 commented
You're right. cloud_firestore changed the API for aggregate queries in ^4.14.0. I don't know if I can work on it in the coming weeks but I'll happily review a PR if someone volunteers.
Relevant links:
- https://pub.dev/packages/cloud_firestore/changelog#4140
- https://github.com/firebase/flutterfire/pull/11757/files#diff-3a027f0e9f65ddd9f05da511e174069db5c372087904e856834f5901c7aba174
- example PRs of how I implemented FakeAggregateQuerySnapshot.count: #245 and #246
stMerlHin commented
+1
cedvdb commented
alternatively, we might want to furnish an implementation of noSuchMethod so this library does not break everytime firebase adds a feature.