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

fix(firebase_database): Firebase_Database Assertion error on push for sorted FirebaseAnimatedList #9838

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ Alessandro Rossi <alexodus71@gmail.com>
Timur Dyushaliev <timurdyushaliev@gmail.com>
Maaku Saito <maaku0810@gmail.com>
Markus Köhne <markus@koehne.dev>
Dipak Prajapati <dipakp2726@gmail.com>
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,11 @@ class FirebaseSortedList extends ListBase<DataSnapshot>
}

void _onChildAdded(DatabaseEvent event) {
_snapshots.add(event.snapshot);
DataSnapshot dataSnapshot = event.snapshot;

_snapshots.add(dataSnapshot);
_snapshots.sort(comparator);
onChildAdded!(_snapshots.indexOf(event.snapshot), event.snapshot);
Copy link
Author

@dipakp2726 dipakp2726 Nov 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it gives index always -1 when sorting is there

onChildAdded!(_snapshots.indexOf(dataSnapshot), event.snapshot);
dipakp2726 marked this conversation as resolved.
Show resolved Hide resolved
}

void _onChildRemoved(DatabaseEvent event) {
Expand Down