executeQueryUnsynced method

Future<AGConnectCloudDBZoneSnapshot> executeQueryUnsynced({
  1. required AGConnectCloudDBQuery query,
})

You can call this method to query all Cloud DB objects that meet specified conditions but has not been synchronized to the cloud. The query result set contains the objects that are added or modified locally, but does not contain the deleted objects.

Comply with the following rules when invoking this method:

  • You can call this method to query objects that are not synchronized to the cloud only when Cloud DB zone is opened. Otherwise, the query will fail.
  • You can call this method to obtain objects that are not synchronized to the cloud only when the data synchronization mode is cache mode.
  • The startAt(), startAfter(), endAt(), and endBefore() methods cannot be used as query conditions.

Implementation

Future<AGConnectCloudDBZoneSnapshot> executeQueryUnsynced({
  required AGConnectCloudDBQuery query,
}) async {
  try {
    final Map<dynamic, dynamic>? result =
        await _methodChannel.invokeMethod<Map<dynamic, dynamic>?>(
      _MethodConstants.EXECUTE_QUERY_UNSYNCED,
      <String, dynamic>{
        _KeyConstants.ZONE_ID: _id,
        _KeyConstants.QUERY: query.query,
      },
    );
    return AGConnectCloudDBZoneSnapshot._fromMap(
        Map<String, dynamic>.from(result!));
  } catch (e) {
    throw AGConnectCloudDBException._from(e);
  }
}