ShadertoyHttpOptions constructor
ShadertoyHttpOptions({})
Builds a ShadertoyHttpOptions
baseUrl
: The base url of the shadertoy website, defaults to ShadertoyHttpOptions.defaultBaseUrl- supportsCookies: If the http client should support cookies
poolMaxAllocatedResources
: The maximum number of resources allocated for parallel calls, defaults to ShadertoyHttpOptions.defaultPoolMaxAllocatedResourcespoolTimeout
: The timeout before giving up on a call, defaults to ShadertoyHttpOptions.defaultPoolTimeoutretryMaxAttempts
: The maximum number of attempts at a failed request, defaults to ShadertoyHttpOptions.defaultRetryMaxAttemptsshaderCount
: The number of shaders fetched in a paged call, defaults to ShadertoyHttpOptions.defaultShaderCounterrorHandling
: The error handling mode
Implementation
ShadertoyHttpOptions(
{String? baseUrl,
required this.supportsCookies,
int? poolMaxAllocatedResources,
int? poolTimeout,
int? retryMaxAttempts,
int? shaderCount,
ErrorMode? errorHandling})
: baseUrl = baseUrl ?? defaultBaseUrl,
poolMaxAllocatedResources =
poolMaxAllocatedResources ?? defaultPoolMaxAllocatedResources,
poolTimeout = poolTimeout ?? defaultPoolTimeout,
retryMaxAttempts = retryMaxAttempts ?? defaultRetryMaxAttempts,
shaderCount = shaderCount ?? defaultShaderCount,
super(errorHandling: errorHandling) {
assert(this.baseUrl.isNotEmpty, 'baseUrl is empty');
assert(this.poolMaxAllocatedResources >= 1,
'poolMaxAllocatedResources is greater or equal to one');
assert(this.poolTimeout >= 0, 'poolTimeout is greater or equal to zero');
assert(this.retryMaxAttempts >= 0,
'retryMaxAttempts is greater or equal to zero');
assert(
this.shaderCount > 0, 'shaderCount should be greater or equal to zero');
}