-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
Bug report
Describe the bug
When i do: REFERENCE.orderByKey().startAt(...).endAt(...) to listen to changes (onAdded, onChanged, onRemoved) it is working fine, unless i
make another request for the same database REFERENCE like: REFERENCE.orderByKey().startAt(...).endAt(...).get() with let's say smaller range.
Then first listener show results for range from .GET()
Steps to reproduce
Steps to reproduce the behavior:
- Start listeners (onAdded, change, removed) for REFERENCE.orderByKey().startAt(START).endAt(END)
- Get data from database with: REFERENCE..orderByKey().startAt(START2).endAt(END2) (with smaller range than above)
- Listeners starts showing data from START2 to END2
Expected behavior
Listener should show data from START to END
Sample project
Database items:
ref/items (key, value):
(1,1),
(2,2),
(10,10),
(31, 31)
onPressed: (){
Query query = FirebaseDatabase.instance.ref().child('items').orderByKey().startAt('1').endAt('31');
query.onChildAdded.listen((event) {
print('added ${event.snapshot.key}');
});
FirebaseDatabase.instance.ref().child('items').orderByKey().startAt('10').endAt('20').get();
}
Console output:
I/flutter ( 8219): added 10
Additional context
Add any other context about the problem here.
Flutter doctor
Run flutter doctor and paste the output below:
Click To Expand
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.22000.795], locale pl-PL)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.6)
[√] Android Studio (version 2020.3)
[√] Android Studio (version 2021.2)
[√] VS Code (version 1.69.2)
[√] Connected device (4 available)
[√] HTTP Host Availability
• No issues found!
Flutter dependencies
Run flutter pub deps -- --style=compact and paste the output below:
Click To Expand
firebase_auth: ^3.4.1
firebase_analytics: ^9.1.12
firebase_database: ^9.0.18
firebase_messaging: ^11.4.4
firebase_storage: ^10.3.1
firebase_core: ^1.19.1
google_mobile_ads: ^1.3.0
firebase_crashlytics: ^2.8.4
firebase_dynamic_links: ^4.3.1
cloud_functions: ^3.3.3