paginate_firestore_plus 1.0.0+1 paginate_firestore_plus: ^1.0.0+1 copied to clipboard
A flutter package to simplify pagination with firestore data.
Pagination in Firestore #
This package is an updated version of the original paginate_firestore. The original package, developed by Venkatesh Prasad, is no longer being actively maintained.
We have taken the initiative to update and enhance this package to ensure its continued functionality and compatibility with the latest versions of Firestore and its dependencies.
Setup #
Use the same setup used for cloud_firestore_plus
package (or follow this).
Usage #
In your pubspec.yaml
dependencies:
paginate_firestore_plus: # latest version
Import it
import 'package:paginate_firestore/paginate_firestore_plus.dart';
Implement it
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:
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. If you fixed a bug or implemented a feature, please send a pull request.
Getting Started #
This project is a starting point for a Dart package, 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, which offers tutorials, samples, guidance on mobile development, and a full API reference.
Credits #
All credit for the initial development of this package goes to Venkatesh Prasad and all other contributors. Without their hard work and dedication, this updated version would not have been possible. We are deeply grateful for their contributions and hope to honor their efforts with this updated release.