ApiService constructor
ApiService(})
Creates an instance of ApiService.
endpoint: The HTTP URL to an Archethic node.maxRetries: The maximum number of retries for failed requests. Defaults to5.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,
),
),
);