ApiService constructor

ApiService(
  1. String endpoint, {
  2. int maxRetries = 5,
  3. Duration retryDelay(
    1. int retryCount
    ) = _defaultRetryDelay,
})

Creates an instance of ApiService.

  • endpoint: The HTTP URL to an Archethic node.
  • maxRetries: The maximum number of retries for failed requests. Defaults to 5.
  • retryDelay: A function that calculates the delay between retries. Defaults to _defaultRetryDelay.

Implementation

ApiService(
  this.endpoint, {
  this.maxRetries = 5,
  this.retryDelay = _defaultRetryDelay,
}) : _client = GraphQLClient(
        link: HttpLink('$endpoint/api'),
        cache: GraphQLCache(),
        queryRequestTimeout: const Duration(seconds: 30),
        defaultPolicies: DefaultPolicies(
          query: Policies(
            fetch: FetchPolicy.noCache,
            error: ErrorPolicy.all,
          ),
        ),
      );