Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -883,8 +883,7 @@ class FirebaseDatabasePlugin :
val value = modifier["value"]
query = when (value) {
is String -> query.startAt(value)
is Double -> query.startAt(value)
is Int -> query.startAt(value.toDouble())
is Number -> query.startAt(value.toDouble())
is Boolean -> query.startAt(value)
else -> query.startAt(value.toString())
}
Expand Down
20 changes: 20 additions & 0 deletions tests/integration_test/firebase_database/query_e2e.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,26 @@ void setupQueryTests() {
expect(snapshot.value, isNull);
});

test(
'streams respect orderByChild with numeric startAt',
() async {
await ref.set({
't1': {'timestamp': 1, 'value': 'old'},
't2': {'timestamp': 1000, 'value': 'current'},
});

final events = await ref
.orderByChild('timestamp')
.startAt(1000)
.onChildAdded
.take(1)
.toList();

expect(events.single.snapshot.key, 't2');
expect(events.single.snapshot.child('value').value, 'current');
},
);

test('starts at the correct value', () async {
await ref.set({
'a': 1,
Expand Down
Loading