GcsResumableFileUploader constructor
GcsResumableFileUploader(})
timeout bounds connecting, the response wait, and time without send
progress. chunkSize must be a multiple of chunkSizeUnit.
Throws FormatException if uploadDescription is not a resumable
description.
Implementation
GcsResumableFileUploader(
final String uploadDescription, {
final Dio? dio,
final Duration? timeout,
final int chunkSize = defaultChunkSize,
final int maxRetries = defaultMaxRetries,
final Duration Function(int attempt)? retryDelay,
}) : _sessionUri = ResumableUploadDescription.parse(uploadDescription).url,
_stallTimeout = timeout,
_chunkSize = chunkSize,
_maxRetries = maxRetries,
_retryDelay = retryDelay ?? _exponentialDelay,
_dio =
dio ??
Dio(BaseOptions(connectTimeout: timeout, receiveTimeout: timeout)) {
if (chunkSize <= 0 || chunkSize % chunkSizeUnit != 0) {
throw ArgumentError.value(
chunkSize,
'chunkSize',
'must be a positive multiple of $chunkSizeUnit bytes',
);
}
if (maxRetries < 0) {
throw ArgumentError.value(
maxRetries,
'maxRetries',
'must not be negative',
);
}
}