Description
I am using PowerSync in my Flutter app, and I need to listen for real-time updates in my local database. However, db.watch
is not triggering updates when changes occur in the synced tables.
Code Implementation
This is how I'm using db.watch in my app:
var stream = db.watch(
'SELECT * FROM events WHERE creator_user = ${FFAppState().user.userId} OR ${FFAppState().user.userId} = ANY(manager_ids) ORDER BY start_date ASC');
eventsSubscription = stream.listen((data) {
callback(data.map((json) => EventsRow(Map<String, dynamic>.from(json))).toList());
});
The query works as expected in the PowerSync console but does not work inside the Flutter app.
Even when testing via the PowerSync diagnostics platform, the query does not return results.
There issue in IN and ANY Query.
Screenshots
The following screenshots illustrate the issue:
I have verified that the table is updating correctly by running sync rules.
No errors or exceptions appear in the logs related to db.watch.
Manually querying the database reflects expected changes, but the listener does not trigger.
Would appreciate any guidance on resolving this issue. Thanks in advance! 🚀