SanityClient constructor

SanityClient(
  1. SanityConfig config, {
  2. Client? httpClient,
  3. UrlBuilder? urlBuilder,
})

Creates a new Sanity client with the provided configuration. Use the optional parameters to provide a custom HTTP client or URL builder.

Implementation

SanityClient(
  this.config, {
  final http.Client? httpClient,
  final UrlBuilder? urlBuilder,
})  : httpClient = httpClient ?? http.Client(),
      urlBuilder = urlBuilder ?? SanityUrlBuilder(config),
      _requestHeaders = {'Authorization': 'Bearer ${config.token}'};