executeQuery method Null safety

Future<AGConnectCloudDBZoneSnapshot> executeQuery(
  1. {required AGConnectCloudDBQuery query,
  2. required AGConnectCloudDBZoneQueryPolicy policy}
)

You can invoke this method to query object data that meets specific conditions from the Cloud DB zone.

Comply with the following rules when invoking this method:

  • You can invoke this method to query object data only when Cloud DB zone is opened. Otherwise, the query will fail.
  • When querying data, ensure that the size of each query result is less than or equal to 5 MB. Otherwise, the query fails.
  • It is recommended that the number of data records in the query result be less than or equal to 100. Otherwise, the performance deteriorates. The number of data records in the query result cannot exceed 1000. Otherwise, the query fails.

Implementation

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