-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
Is there an existing issue for this?
- I have searched the existing issues.
Which plugins are affected?
Database
Which platforms are affected?
Android
Description
After upgrading firebase_database plugin from version 12.0.4 to 12.1.0 , I am facing an issue on Android where the following query no longer triggers the listener:
_chatSubscription = _chatRef
.orderByChild('timestamp')
.startAt(DateTime.now().millisecondsSinceEpoch)
.onChildAdded
.listen(_handleChatEvent);
However, if I remove .orderByChild('timestamp') , the listener works perfectly on Android. On iOS, the full query including orderByChild and startAt works as expected.
This indicates a platform-specific difference in how the Firebase Realtime Database queries are handled between Android and iOS in Flutter.
Steps to reproduce:
1. Setup a Firebase Realtime Database with child nodes having a timestamp key stored as milliseconds since epoch.
2. Use the above query to listen for new child additions with timestamp greater than or equal to the current time.
3. Observe that on Android the listener does not trigger, but on iOS it does.
Expected behavior:
The listener should respond to new child additions where timestamp >= startAt on both Android and iOS platforms.
Actual behavior:
• Android: Listener does not trigger.
• iOS: Listener triggers and processes events as expected
Steps to reproduce:
1. Setup Firebase Realtime Database with numeric timestamp fields.
2. Use the above query to listen for new child additions on both Android and iOS.
3. Upgrade the firebase_database plugin to 12.1.0 .
4. Observe listener not responding on Android with orderByChild filter applied.
Environment:
• Flutter version: 3.38.3 stable
• firebase_database plugin: 12.1.0 (issue appears after upgrading from 12.0.4)
• Android SDK: 36.1.0
• Xcode: 26.1.1
• Development on macOS 26.1 with arm64 architecture
Additional info:
• Data timestamp field is consistently stored as numbers (milliseconds since epoch).
• Firebase rules are identical for both platforms.
• Network connection is stable.
• Downgrading firebase_database back to 12.0.4 resolves the issue on Android.
Reproducing the issue
1.Setup Firebase Realtime Database with numeric timestamp fields.
2.Use the above query to listen for new child additions on both Android and iOS.
3.Upgrade the firebase_database plugin to 12.1.0 .
4.Observe listener not responding on Android with orderByChild filter applied.
Firebase Core version
4.2.1
Flutter Version
3.38.3
Relevant Log Output
Flutter dependencies
Expand Flutter dependencies snippet
Replace this line with the contents of your `flutter pub deps -- --style=compact`.
Additional context and comments
No response