Skip to content
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

feat(ui_firestore): add includeMetadataChanges parameter to FirestoreQueryBuilder #349

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion packages/firebase_ui_firestore/lib/src/query_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class FirestoreQueryBuilder<Document> extends StatefulWidget {
required this.query,
required this.builder,
this.pageSize = 10,
this.includeMetadataChanges = false,
this.child,
}) : assert(pageSize > 1, 'Cannot have a pageSize lower than 1');

Expand All @@ -85,6 +86,10 @@ class FirestoreQueryBuilder<Document> extends StatefulWidget {
/// When it changes, the current progress will be preserved.
final int pageSize;

/// Whether to include metadata changes in the query.
/// Defaults to false.
final bool includeMetadataChanges;

final FirestoreQueryBuilderSnapshotBuilder<Document> builder;

/// A widget that will be passed to [builder] for optimizations purpose.
Expand Down Expand Up @@ -172,7 +177,9 @@ class _FirestoreQueryBuilderState<Document>

final query = widget.query.limit(expectedDocsCount);

_querySubscription = query.snapshots().listen(
_querySubscription = query
.snapshots(includeMetadataChanges: widget.includeMetadataChanges)
.listen(
(event) {
setState(() {
if (nextPage) {
Expand Down Expand Up @@ -432,6 +439,7 @@ class FirestoreListView<Document> extends FirestoreQueryBuilder<Document> {
required super.query,
required FirestoreItemBuilder<Document> itemBuilder,
super.pageSize,
super.includeMetadataChanges,
FirestoreLoadingBuilder? loadingBuilder,
FirestoreFetchingIndicatorBuilder? fetchingIndicatorBuilder,
FirestoreErrorBuilder? errorBuilder,
Expand Down Expand Up @@ -543,6 +551,7 @@ class FirestoreListView<Document> extends FirestoreQueryBuilder<Document> {
required super.query,
required FirestoreItemBuilder<Document> itemBuilder,
super.pageSize,
super.includeMetadataChanges,
FirestoreLoadingBuilder? loadingBuilder,
FirestoreFetchingIndicatorBuilder? fetchingIndicatorBuilder,
FirestoreErrorBuilder? errorBuilder,
Expand Down