run method

FutureOr run(
  1. String query, {
  2. bool count = true,
  3. int batchSize = 2,
  4. Map<String, dynamic>? options,
})

Implementation

FutureOr<dynamic> run(String query,
    {bool count = true,
    int batchSize = 2,
    Map<String, dynamic>? options}) async {
  var request = client.prepareRequest('/_api/cursor', methode: 'post');
  if (options != null) {
    request.body = jsonEncode({
      'query': query,
      'count': count,
      'batchSize': batchSize,
      'options': options
    });
  } else {
    request.body =
        jsonEncode({'query': query, 'count': count, 'batchSize': batchSize});
  }
  var doc = await client.exec(request);
  if (doc['error']) {
    print(doc['errorMessage']);
    return null;
  } else {
    return doc;
  }
}