https://github.com/vedartm/paginate_firestore
A flutter package to simplify pagination with firestore data π
https://github.com/vedartm/paginate_firestore
dart firebase firestore flutter flutter-package pagination pagination-library
Last synced: 4 months ago
JSON representation
A flutter package to simplify pagination with firestore data π
- Host: GitHub
- URL: https://github.com/vedartm/paginate_firestore
- Owner: vedartm
- License: mit
- Created: 2020-04-29T16:32:15.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-08-19T13:14:04.000Z (almost 2 years ago)
- Last Synced: 2026-01-11T10:41:29.451Z (5 months ago)
- Topics: dart, firebase, firestore, flutter, flutter-package, pagination, pagination-library
- Language: Dart
- Homepage: https://pub.dev/packages/paginate_firestore
- Size: 1.03 MB
- Stars: 111
- Watchers: 7
- Forks: 139
- Open Issues: 37
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Pagination in Firestore
[](#contributors-)
[](https://pub.dev/packages/paginate_firestore)
[](https://github.com/tenhobi/effective_dart)
[](https://opensource.org/licenses/MIT)
## Setup
Use the same setup used for `cloud_firestore` package (or follow [this](https://pub.dev/packages/cloud_firestore#setup)).
## Usage
In your pubspec.yaml
```yaml
dependencies:
paginate_firestore: # latest version
```
Import it
```dart
import 'package:paginate_firestore/paginate_firestore.dart';
```
Implement it
```dart
PaginateFirestore(
//item builder type is compulsory.
itemBuilder: (context, documentSnapshots, index) {
final data = documentSnapshots[index].data() as Map?;
return ListTile(
leading: CircleAvatar(child: Icon(Icons.person)),
title: data == null ? Text('Error in data') : Text(data['name']),
subtitle: Text(documentSnapshots[index].id),
);
},
// orderBy is compulsory to enable pagination
query: FirebaseFirestore.instance.collection('users').orderBy('name'),
//Change types accordingly
itemBuilderType: PaginateBuilderType.listView,
// to fetch real-time data
isLive: true,
),
```
To use with listeners:
```dart
PaginateRefreshedChangeListener refreshChangeListener = PaginateRefreshedChangeListener();
RefreshIndicator(
child: PaginateFirestore(
itemBuilder: (context, documentSnapshots, index) => ListTile(
leading: CircleAvatar(child: Icon(Icons.person)),
title: Text(documentSnapshots[index].data()['name']),
subtitle: Text(documentSnapshots[index].id),
),
// orderBy is compulsary to enable pagination
query: Firestore.instance.collection('users').orderBy('name'),
listeners: [
refreshChangeListener,
],
),
onRefresh: () async {
refreshChangeListener.refreshed = true;
},
)
```
## Contributions
Feel free to contribute to this project.
If you find a bug or want a feature, but don't know how to fix/implement it, please fill an [issue](https://github.com/excogitatr/paginate_firestore/issues).
If you fixed a bug or implemented a feature, please send a [pull request](https://github.com/excogitatr/paginate_firestore/pulls).
## Getting Started
This project is a starting point for a Dart
[package](https://flutter.dev/developing-packages/),
a library module containing code that can be shared easily across
multiple Flutter or Dart projects.
For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
## Contributors β¨
Thanks goes to these wonderful people:

Adam Dupuis
π»

Gautham
π»

Hafeez Ahmed
π»

Claudemir Casa
π»

Nikhil27bYt
π

Ferri Sutanto
π»

jslattery26
π»

garrettApproachableGeek
π»

Sua MΓΊsica
π»

Austin Nelson
π»
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!