exists method

Future<bool> exists(
  1. String index,
  2. String collection
)

Checks whether a collection exists in the index.

Implementation

Future<bool> exists(String index, String collection) async {
  final response = await kuzzle.query(KuzzleRequest(
    controller: name,
    action: 'exists',
    index: index,
    collection: collection,
  ));

  if (response.result is bool) {
    return response.result as bool;
  }

  throw BadResponseFormatError(
      response.error?.id, '$name.exists: bad response format', response);
}