I am trying to establish a LiveQuery with a query using the whereEqualTo
statement. Once I start my app the debug console gives me the following - so I assume the connection is fine.
flutter: LiveQuery: : Socket opened
flutter: LiveQuery: : ConnectMessage: {op: connect, applicationId: SL0zySmAoBus5vtNoTPis7odg85IUCdEwFpXM1cX, clientKey: OGNqC9YZMsOK7KaRt0JDkvDm13AnhJUka2WxipaW}
flutter: LiveQuery: : Listen: {"op":"connected","clientId":"073e7e6d-ba78-47bb-860b-41cbda2f32f4"}
flutter: Re subscription:{}
flutter: LiveQueryReconnectingController: LiveQueryClientEvent.connected
flutter: LiveQuery: : SubscribeMessage: {op: subscribe, requestId: 1, query: {className: rounds, where: {commonId: h1qUwTisSQ}, fields: [contribution]}}
flutter: LiveQuery: : Listen: {"op":"subscribed","clientId":"073e7e6d-ba78-47bb-860b-41cbda2f32f4","requestId":1}
However, if I update the database there is nothing received. Also if I comment out ..whereEqualTo('commonId', 'h1qUwTisSQ')
the live query is working as it should. The exact same query works as Future object.
The query looks as follows and I expected to receive updated data everytime I update the database.
class _CommonState extends State<Common> {
final LiveQuery liveQuery = LiveQuery();
final QueryBuilder<ParseObject> queryContribution =
QueryBuilder<ParseObject>(ParseObject('rounds'))
..whereEqualTo('commonId', 'h1qUwTisSQ')
..orderByAscending('createdAt')
..keysToReturn(['contribution']);
startLiveQuery();
void startLiveQuery() async {
Subscription subscription =
await liveQuery.client.subscribe(queryContribution);
subscription.on(LiveQueryEvent.update, (value) {
debugPrint("OBJECT UPDATE: $value");
});
}
Note: commonId
is a Pointer column in the table rounds
.
I figured it out myself. A pointer in Parse Server cannot be specified by a simple String. Instead it can be specified by the following notation.