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

Fetch Data from Firebase Realtime Database in Descending Order[Feature Request] #33

Closed
CodeWithBishal opened this issue Dec 16, 2023 · 2 comments · Fixed by #34
Closed
Labels
enhancement New feature or request realtime-db pagination Only affects Realtime Database pagination

Comments

@CodeWithBishal
Copy link
Contributor

Is it possible to fetch data using RealtimeDBPagination in Descending Order?

Basically I want my latest data to be on the top of the screen and older to the bottom of the screen.

A walkthrough would be appreciated.

Thanks,

@CodeWithBishal CodeWithBishal added the in-triage Presently being triaged label Dec 16, 2023
@CodeWithBishal
Copy link
Contributor Author

CodeWithBishal commented Dec 16, 2023

changed _data with _data.toList().reversed.toList() works fine for me. We can ask if data should be reversed in the widget and define it as

widget.reverseData ? _data.toList().reversed.toList() : _data

We also gotta change:

var docsQuery = widget.reverseData ? widget.query.limitToLast(docsLimit) : widget.query.limitToFirst(docsLimit);

should I create a PR?

@OutdatedGuy
Copy link
Owner

@CodeWithBishal, yeah the problem is Firebase Realtime Database doesn't support decending orderBy.

I'm quite busy right now, so PRs are welcomed.

Just heads up

I'm currently not actively maintaining this particular package. So instead I would suggest using the official firebase pagination package for realtime database.

CodeWithBishal added a commit to CodeWithBishal/firebase_pagination that referenced this issue Dec 17, 2023
@CodeWithBishal CodeWithBishal mentioned this issue Dec 17, 2023
OutdatedGuy added a commit that referenced this issue Dec 27, 2023
* Fix #33

* v3.0.2

* rollback version no.

* Update README.md

* refactor: fixed docs and removed unnecessary `toList`

* fix: incorrect queries for decending type

* fix: data not inserted properly for descending type

---------

Co-authored-by: OutdatedGuy <everythingoutdated@gmail.com>
@OutdatedGuy OutdatedGuy added enhancement New feature or request realtime-db pagination Only affects Realtime Database pagination and removed in-triage Presently being triaged labels Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request realtime-db pagination Only affects Realtime Database pagination
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants