uploadChunk method

  1. @override
Future<void> uploadChunk(
  1. FileUploadPresentationResponse presentation,
  2. FileChunk chunk, {
  3. ProgressCallback? onProgress,
})

method to handle the upload of a FileChunk.

presentation is the response of the present method.

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(
  presentation,
  chunk,
  onProgress: (progress, total) {
  print('Upload progress: $progress of $total');
});

Implementation

@override
Future<void> uploadChunk(
  FileUploadPresentationResponse presentation,
  FileChunk chunk, {
  ProgressCallback? onProgress,
}) async {
  return _client
      .sendChunk<dynamic>(
        method: chunkMethod,
        path: chunkPath(presentation, chunk),
        chunk: chunk,
        headers: chunkHeaders?.call(presentation, chunk),
        onProgress: onProgress,
        fileKey: fileKey,
      )
      .then(chunkParser);
}