uploadChunk method
method to handle the upload of a FileChunk
chunk is the chunk to upload.
onProgress is a callback that will be called
with the progress of the upload. The callback
will receive the current progress
and the total size of the file.
controller.uploadChunk(chunk, onProgress: (progress, total) {
print('Upload progress: $progress of $total');
});
Implementation
@override
Future<void> uploadChunk(
FileChunk chunk, {
ProgressCallback? onProgress,
}) async {
await _client
.sendChunk<dynamic>(
method: method,
path: path,
chunk: chunk,
fileKey: fileKey,
cancelToken: cancelToken,
headers: headers?.call(chunk),
onProgress: onProgress,
)
.then(chunkParser);
return;
}