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 {
  if (query == null) {
    throw FormatException('Value of query cannot be null.', query);
  }

  try {
    final Map<dynamic, dynamic> result = await _methodChannel.invokeMethod<Map<dynamic, dynamic>>(
      MethodConstants.EXECUTE_QUERY_UNSYNCED,
      <String, dynamic>{
        KeyConstants.ZONE_ID: this._id,
        KeyConstants.QUERY: query.query,
      },
    );
    return AGConnectCloudDBZoneSnapshot.fromMap(Map<String, dynamic>.from(result));
  } catch (e) {
    throw AGConnectCloudDBException.from(e);
  }
}