Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Conversation

@kroikie
Copy link
Contributor

@kroikie kroikie commented Jul 26, 2019

Description

Bring cloud_firestore plugin in line with native SDKs by exposing the metadata of QuerySnapshot.

Related Issues

Fixes: flutter/flutter#35550

@kroikie kroikie changed the title Add metadata to QuerySnapshot [WIP][cloud_firestore] Add metadata to QuerySnapshot Jul 26, 2019
Copy link
Contributor

@collinjackson collinjackson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder to update CHANGELOG and pubspec before merging.

stream: firestore.collection('messages').snapshots(),
builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
if (!snapshot.hasData) return const Text('Loading...');
print(snapshot.data.metadata.isFromCache);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest removing these.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops that was not supposed to make it into the PR, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

/// is the first snapshot, all documents will be in the list as Added changes.
final List<DocumentChange> documentChanges;

final SnapshotMetadata metadata;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be able to add unit testing and a basic integration test for this, right? Even just asserting that hasPendingWrites and isFromCache aren't null would be better than nothing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, I checked that the metadata property of the QuerySnapshot was not null.

@kroikie kroikie force-pushed the add_querysnapshot_metadata branch from 66deb36 to 8748653 Compare July 26, 2019 22:43
@kroikie kroikie changed the title [WIP][cloud_firestore] Add metadata to QuerySnapshot [cloud_firestore] Add metadata to QuerySnapshot Jul 26, 2019
@@ -1,3 +1,7 @@
## 0.12.8+1

* Add metatdata to QuerySnapshot.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Add metatdata to QuerySnapshot.
* Add `metadata` to `QuerySnapshot`.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@kroikie
Copy link
Contributor Author

kroikie commented Jul 26, 2019

Once tests pass I'll merge and publish.

@kroikie kroikie force-pushed the add_querysnapshot_metadata branch from c9c8d61 to 99d6275 Compare July 26, 2019 23:52
@collinjackson
Copy link
Contributor

This looks ready to merge, thanks!

@kroikie kroikie merged commit 7ee7025 into flutter:master Jul 28, 2019
mithun-mondal pushed a commit to bKash-developer/archived_plugins that referenced this pull request Aug 6, 2019
julianscheel pushed a commit to jusst-engineering/plugins that referenced this pull request Mar 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cloud_firestore needs metadata for QuerySnapshot (in addition to DocumentSnapshots in it)

3 participants