SearchClient constructor

SearchClient({
  1. required String appId,
  2. required String apiKey,
  3. ClientOptions options = const ClientOptions(),
})

Implementation

SearchClient({
  required this.appId,
  required this.apiKey,
  this.options = const ClientOptions(),
}) : _retryStrategy = RetryStrategy.create(
        segment:
            AgentSegment(value: "Algoliasearch", version: packageVersion),
        appId: appId,
        apiKey: apiKey,
        options: options,
        defaultHosts: () =>
            [
              Host(url: '$appId-dsn.algolia.net', callType: CallType.read),
              Host(url: '$appId.algolia.net', callType: CallType.write),
            ] +
            ([
              Host(url: '$appId-1.algolianet.com'),
              Host(url: '$appId-2.algolianet.com'),
              Host(url: '$appId-3.algolianet.com'),
            ]..shuffle()),
      ) {
  assert(appId.isNotEmpty, '`appId` is missing.');
  assert(apiKey.isNotEmpty, '`apiKey` is missing.');
}