FirestorePagingController<ItemType> class
Creates a FirestorePagingController that fetches items from Firestore and paginates them to be used with infinite_scroll_pagination views, like PagedListView.
Parameters:
basePath- The base path to the collection in Firestorefirestore- The Firestore instance to use. If not provided, it will use the default instance.queryBuilders- A list of query builders. If you want to fetch all items, leave it null.fromMap- A function to convert a Firestore document to the desired item type.pageSize- The number of items to fetch per page. Default is 10. When there are multiple queryBuilders, the pageSize is the total number of items to fetch per query. If more than one query is provided, there is no guarantee that each query will have the same number of items to show at the same time. Every batch will have from 0 to pageSize * queryBuilders.length itemsorderBy- The field to order the items by. It can't be a documentId because the cursor is based on the last document fetched, and we use startAfterDocument to fetch the next page.orderByDescending- Whether to order the items in descending order. Default is false.
- Inheritance
-
- Object
- ChangeNotifier
- ValueNotifier<
PagingState< int, QueryDocumentSnapshot< >ItemType> > - PagingController<
int, QueryDocumentSnapshot< ItemType> > - FirestorePagingController
Constructors
-
FirestorePagingController.converted({required String basePath, FirebaseFirestore? firestore, List<
Query< ? queryBuilders, required FromMap<ItemType> Function(CollectionReference<ItemType> query)>ItemType> fromMap, int pageSize = 10, String? orderBy, bool orderByDescending = false}) - Creates a FirestorePagingController that fetches items from Firestore and paginates them to be used with infinite_scroll_pagination views, like PagedListView.
Properties
- basePath → String
-
The base path to the collection in Firestore
final
- error ↔ dynamic
-
The current error, if any. Initially
null.getter/setter pairinherited - firestore → FirebaseFirestore
-
The Firestore instance to use. If not provided, it will use the default instance.
final
- firstPageKey → int
-
The key for the first page to be fetched.
finalinherited
-
fromMap
→ FromMap<
ItemType> -
A function to convert a Firestore document to the desired item type.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- invisibleItemsThreshold → int?
-
The number of remaining invisible items that should trigger a new fetch.
finalinherited
-
itemList
↔ List<
QueryDocumentSnapshot< ?ItemType> > -
List with all items loaded so far. Initially
null.getter/setter pairinherited - nextPageKey ↔ int?
-
The key for the next page to be fetched.
getter/setter pairinherited
- orderBy → String?
-
The field to order the items by. It can't be a documentId because
the cursor is based on the last document fetched, and we use startAfterDocument
to fetch the next page.
final
- orderByDescending → bool
-
Whether to order the items in descending order. Default is false.
final
- pageSize → int
-
The number of items to fetch per page. Default is 10. When there are multiple
queryBuilders, the pageSize is the total number of items to fetch per query. If
more than one query is provided, there is no guarantee that each query will have the same number of items to show at
the same time. Every batch will have from 0 to pageSize * queryBuilders.length items
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
value
↔ PagingState<
int, QueryDocumentSnapshot< ItemType> > -
The current value stored in this notifier.
getter/setter pairinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
addPageRequestListener(
PageRequestListener< int> listener) → void -
Calls listener every time new items are needed.
inherited
-
addStatusListener(
PagingStatusListener listener) → void -
Calls listener every time the status of the pagination changes.
inherited
-
appendLastPage(
List< QueryDocumentSnapshot< newItems) → voidItemType> > -
Appends
newItemsto the previously loaded ones and sets the next page key tonull.inherited -
appendPage(
List< QueryDocumentSnapshot< newItems, int? nextPageKey) → voidItemType> > -
Appends
newItemsto the previously loaded ones and replaces the next page's key.inherited -
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
notifyPageRequestListeners(
int pageKey) → void -
Calls all the page request listeners.
inherited
-
notifyStatusListeners(
PagingStatus status) → void -
Calls all the status listeners.
inherited
-
refresh(
) → void -
Resets value to its initial state.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
removePageRequestListener(
PageRequestListener< int> listener) → void -
Stops calling the listener every time new items are needed.
inherited
-
removeStatusListener(
PagingStatusListener listener) → void -
Stops calling the listener every time the status of the pagination
changes.
inherited
-
retryLastFailedRequest(
) → void -
Erases the current error.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
withoutType(
{required String basePath, FirebaseFirestore? firestore, List< Query< ? queryBuilders, int pageSize = 10, String? orderBy, bool orderByDescending = false}) → FirestorePagingController<StringMap> Function(CollectionReference<StringMap> query)>StringMap> - Creates a FirestorePagingController that fetches items from Firestore and paginates them to be used with infinite_scroll_pagination views, like PagedListView.