-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: withConverter #99
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## main #99 +/- ##
============================================
- Coverage 100.00% 86.84% -13.16%
============================================
Files 1 1
Lines 31 38 +7
============================================
+ Hits 31 33 +2
- Misses 0 5 +5
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for raising this PR. Would you be able to address these comments?
/// pass toFirestore method to converter | ||
static Future<QuerySnapshot<T>> getDocuments<T>({ | ||
required Query<T> query, | ||
required DocumentReference<T> cacheDocRef, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can understand the use case for Query<T>
then returning QuerySnapshot<T>
. But can people simply pass in the default Map<String, dynamic>
for cacheDocRef
? For the example code you shared, can you pass in FirebaseFirestore.instance.doc('col/doc')
instead? This document is simply used for fetching the cache date info, so I would imagine there's no need to use the parameter with the converters.
Also, I don't think it can use the same type T
which is used for Query
and the returned QuerySnapshot
>, as it probably has a different type.
now support firestore documents with custom converter
before documents initiated with withConverter collection couldn't be passed into function because
function takes DocumentReference<Map<String,dynamic>> type but our doc is DocumentReference type
error befor---
`
final doc=i.collection("col").withConverter(fromFirestore: fromFirestore, toFirestore: toFirestore).doc("doc");
`