adminExists method

Future<bool> adminExists()

Checks if an administrator user exists

Implementation

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

  final result = response.result as Map<String, dynamic>?;

  if (result != null && result.containsKey('exists')) {
    if (result['exists'] is bool) {
      return result['exists'] as bool;
    }
  }

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