MultiUploadWorker class final
Upload multiple files in a single multipart/form-data HTTP request.
Reuses the existing HttpUploadWorker native implementation which
already supports the files array format.
Example:
await NativeWorkManager.enqueue(
taskId: 'batch-upload',
trigger: const TaskTrigger.oneTime(),
worker: NativeWorker.multiUpload(
url: 'https://api.example.com/photos',
files: [
const UploadFile(filePath: '/cache/photo1.jpg', fieldName: 'photos'),
const UploadFile(filePath: '/cache/photo2.jpg', fieldName: 'photos'),
const UploadFile(filePath: '/cache/document.pdf', fieldName: 'docs',
mimeType: 'application/pdf'),
],
headers: {'Authorization': 'Bearer token'},
additionalFields: {'albumId': '42'},
),
constraints: const Constraints(requiresNetwork: true),
);
Constructors
Properties
-
additionalFields
→ Map<
String, String> -
Additional multipart form fields (non-file fields).
final
-
files
→ List<
UploadFile> -
Files to upload. Must not be empty, maximum 50 files.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
→ Map<
String, String> -
HTTP headers to include in the request.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- timeout → Duration
-
Request timeout.
final
- url → String
-
Upload endpoint URL.
final
- useBackgroundSession → bool
-
Use a background URLSession on iOS (survives app termination).
final
- workerClassName → String
-
Get the worker class name for native side.
no setteroverride
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toMap(
) → Map< String, dynamic> -
Convert to map for platform channel.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited