startUpload abstract method

Future<String> startUpload({
  1. required String filePath,
  2. required String uploadUrl,
  3. Map<String, String>? headers,
  4. Map<String, String>? fields,
})

Starts a file upload operation in the background.

The upload continues even if the app moves to the background. Progress can be tracked using getUploadProgress.

Parameters:

  • filePath: Local path of the file to upload
  • uploadUrl: The URL where the file should be uploaded to
  • headers: Optional HTTP headers to include in the request
  • fields: Optional form fields to include in the multipart request

Returns a task ID string that can be used to track progress or cancel the task.

Throws an Exception if the upload fails to start.

Implementation

Future<String> startUpload({
  required String filePath,
  required String uploadUrl,
  Map<String, String>? headers,
  Map<String, String>? fields,
});