StreamAttachmentUploader class

Uploads StreamAttachment objects to remote storage.

Provides upload functionality with progress tracking and error handling. Automatically selects the appropriate upload method based on attachment type and returns Result objects for explicit success/failure handling.

Example usage:

final uploader = StreamAttachmentUploader(cdn: cdnClient);

final result = await uploader.upload(attachment);
result.fold(
  onSuccess: (uploaded) => print('Uploaded: ${uploaded.remoteUrl}'),
  onFailure: (error, _) => print('Upload failed: $error'),
);
Available extensions

Constructors

StreamAttachmentUploader({required CdnClient cdn})
Creates a StreamAttachmentUploader with the specified cdn client.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
upload(StreamAttachment attachment, {OnUploadProgress? onProgress}) Future<Result<UploadedAttachment>>
Uploads a single attachment to remote storage.
uploadBatch(Iterable<StreamAttachment> attachments, {OnBatchUploadProgress? onProgress, int maxConcurrent = 5, bool eagerError = false}) Stream<Result<UploadedAttachment>>

Available on StreamAttachmentUploader, provided by the StreamAttachmentUploaderBatch extension

Uploads multiple attachments as a stream of results.

Operators

operator ==(Object other) bool
The equality operator.
inherited