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
Error: The parameter 'values' of the method 'MockQuery.startAt' has type 'List<dynamic>', which does not match the corresponding type, 'Iterable<Object?>', in the overridden method, 'Query.startAt'.
mock_query.dart:125
- 'List' is from 'dart:core'.
- 'Iterable' is from 'dart:core'.
- 'Object' is from 'dart:core'.
Change to a supertype of 'Iterable<Object?>', or, for a covariant parameter, a subtype.
Query<T> startAt(List<dynamic> values) => _subQueryByKeyValues(
^
: Context: This is the overridden method ('startAt').
query.dart:138
Query<T> startAt(Iterable<Object?> values);
^
: Error: The parameter 'values' of the method 'MockQuery.endAt' has type 'List<dynamic>', which does not match the corresponding type, 'Iterable<Object?>', in the overridden method, 'Query.endAt'.
mock_query.dart:134
- 'List' is from 'dart:core'.
- 'Iterable' is from 'dart:core'.
- 'Object' is from 'dart:core'.
Change to a supertype of 'Iterable<Object?>', or, for a covariant parameter, a subtype.
Query<T> endAt(List<dynamic> values) => _subQueryByKeyValues(
^
: Context: This is the overridden method ('endAt').
query.dart:49
Query<T> endAt(Iterable<Object?> values);
^
: Error: The parameter 'arrayContainsAny' of the method 'MockQuery.where' has type 'List<dynamic>?', which does not match the corresponding type, 'Iterable<Object?>?', in the overridden method, 'Query.where'.
mock_query.dart:228
- 'List' is from 'dart:core'.
- 'Iterable' is from 'dart:core'.
- 'Object' is from 'dart:core'.
Change to a supertype of 'Iterable<Object?>?', or, for a covariant parameter, a subtype.
List<dynamic>? arrayContainsAny,
^
: Context: This is the overridden method ('where').
query.dart:151
Query<T> where(
^
: Error: The parameter 'whereIn' of the method 'MockQuery.where' has type 'List<dynamic>?', which does not match the corresponding type, 'Iterable<Object?>?', in the overridden method, 'Query.where'.
mock_query.dart:229
- 'List' is from 'dart:core'.
- 'Iterable' is from 'dart:core'.
- 'Object' is from 'dart:core'.
Change to a supertype of 'Iterable<Object?>?', or, for a covariant parameter, a subtype.
test('FirebaseDB.init() does not throw an exception', () {
finalFakeFirebaseFirestore fakeFirestore =FakeFirebaseFirestore();
expect(
FirebaseDB.init(
fakeFirestore,
// FirebaseFirestore.instance,
participantID:'101',
sessionID:'001',
taskName:'digit_span',
),
returnsNormally);
});
ChatGPT offered the following solution 😅
Update the Type in Your Test:
Since the error is related to the startAt method, you might need to adjust the arguments you pass when using the startAt method in your test. Ensure that the values passed to startAt are of type Iterable<Object?> instead of List. You can use the Iterable constructor to create an iterable from a list:
I am getting an error when running fake_cloud_firestore in unit tests.
packages versions:
fake_cloud_firestore: ^2.1.0
firebase_core: ^2.8.0
cloud_firestore: ^4.4.5
traceback
Code I am testing
unit test code
ChatGPT offered the following solution 😅
Update the Type in Your Test:
Since the error is related to the startAt method, you might need to adjust the arguments you pass when using the startAt method in your test. Ensure that the values passed to startAt are of type Iterable<Object?> instead of List. You can use the Iterable constructor to create an iterable from a list:
The text was updated successfully, but these errors were encountered: