SupabaseStorageClient constructor
SupabaseStorageClient(})
To create a SupabaseStorageClient, you need to provide an url
and headers
.
SupabaseStorageClient(STORAGE_URL, {'apikey': 'foo'});
httpClient
is optional and can be used to provide a custom http client
retryAttempts
specifies how many retry attempts there should be to
upload a file when failed due to network interruption.
Time between each retries are set as the following:
- 400 ms +/- 25%
- 800 ms +/- 25%
- 1600 ms +/- 25%
- 3200 ms +/- 25%
- 6400 ms +/- 25%
- 12800 ms +/- 25%
- 25600 ms +/- 25%
- 30000 ms +/- 25%
Anything beyond the 8th try will have 30 second delay.
Implementation
SupabaseStorageClient(
String url,
Map<String, String> headers, {
Client? httpClient,
int retryAttempts = 0,
}) : assert(
retryAttempts >= 0,
'retryAttempts has to be great than or equal to 0',
),
_defaultRetryAttempts = retryAttempts,
super(
url,
{...Constants.defaultHeaders, ...headers},
httpClient: httpClient,
);