UploadController class
The upload controller manages all logic with the upload state of attachments. Such as:
- a stream of the upload state, progress, error, result: uploadsStream.
- uploading files and images: uploadFile, uploadImage, uploadImages.
- remove uploads: removeUpload
- clear all uploads: clear
Constructors
- UploadController(StreamFeedClient client)
- Creates a new upload controller to manage file/attachment uploads.
Properties
-
cancelMap
↔ Map<
AttachmentFile, CancelToken> -
Store cancel token for each upload.
getter/setter pair
- client → StreamFeedClient
-
Stream Feed Client.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
stateMap
↔ BehaviorSubject<
Map< AttachmentFile, UploadState> > -
A StreamController to keep the state of the uploads.
getter/setter pair
-
uploadsStream
→ Stream<
Map< AttachmentFile, UploadState> > -
The current attachment list as a stream.
no setter
Methods
-
cancelUpload(
AttachmentFile attachmentFile) → void - Cancels the upload of the given AttachmentFile
-
clear(
) → void - Clears all file uploads from the upload ontroller.
-
close(
) → void - Closes the controller
-
getMediaUris(
) → List< MediaUri> ? -
Returns a list of uploads
MediaUri
s. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeUpload(
AttachmentFile file) → void - Remove upload from controller and delete from cdn
-
toString(
) → String -
A string representation of this object.
inherited
-
uploadFile(
AttachmentFile attachmentFile, MediaType mediaType, [CancelToken? cancelToken]) → Future< void> - Uploads the given AttachmentFile as a file (other than an image)
-
uploadFiles(
List< AttachmentFile> attachmentFiles, MediaType mediaType) → Future<void> - Upload files of a specific type.
-
uploadImage(
AttachmentFile attachmentFile, [CancelToken? cancelToken]) → Future< void> - Upload an image.
-
uploadImages(
List< AttachmentFile> attachmentFiles) → Future<void> - Upload several images.
-
uploadMedia(
AttachmentFile attachmentFile, [CancelToken? cancelToken]) → Future< void> - A smart method that will guess the type of the file and upload it using the correct storage method.
-
uploadMedias(
List< AttachmentFile> attachmentFiles) → Future<void> - A smart method that will guess the type of the files and upload them using the correct storage method.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited