exists method

Future<bool> exists(
  1. String index
)

Checks if the given index exists in Kuzzle.

Implementation

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

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

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