AbstractAttachmentQueue class abstract

Abstract class used to implement the attachment queue Requires a PowerSyncDatabase, an implementation of AbstractRemoteStorageAdapter and an attachment directory name which will determine which folder attachments are stored into.

Constructors

AbstractAttachmentQueue({required PowerSyncDatabase db, required AbstractRemoteStorageAdapter remoteStorage, String attachmentDirectoryName = 'attachments', String attachmentsQueueTableName = defaultAttachmentsQueueTableName, Future<bool> onDownloadError(Attachment attachment, Object exception)?, Future<bool> onUploadError(Attachment attachment, Object exception)?, int intervalInMinutes = 5, List<String>? subdirectories})

Properties

attachmentDirectoryName String
getter/setter pair
attachmentsQueueTableName String
getter/setter pair
attachmentsService ↔ AttachmentsService
getter/setter pair
db ↔ PowerSyncDatabase
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
intervalInMinutes int
Interval in minutes to periodically run syncingService.startPeriodicSync Default is 5 minutes
getter/setter pair
localStorage → LocalStorageAdapter
final
onDownloadError ↔ (Future<bool> Function(Attachment attachment, Object exception)?)
Function to handle errors when downloading attachments Return true if you want to ignore attachment
getter/setter pair
onUploadError ↔ (Future<bool> Function(Attachment attachment, Object exception)?)
Function to handle errors when uploading attachments Return true if you want to ignore attachment
getter/setter pair
remoteStorage AbstractRemoteStorageAdapter
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
subdirectories List<String>?
Provide the subdirectories located on external storage so that they are created when the attachment queue is initialized.
getter/setter pair
syncingService ↔ SyncingService
getter/setter pair

Methods

deleteFile(String fileId) Future<Attachment>
Create a function to delete files using the attachment queue
getLocalFilePathSuffix(String filename) String
Returns the local file path for the given filename, used to store in the database. Example: filename: "attachment-1.jpg" returns "attachments/attachment-1.jpg"
getLocalUri(String filePath) Future<String>
Return users storage directory with the attachmentPath use to load the file. Example: filePath: "attachments/attachment-1.jpg" returns "/var/mobile/Containers/Data/Application/.../Library/attachments/attachment-1.jpg"
getStorageDirectory() Future<String>
Returns the directory where attachments are stored on the device, used to make dir Example: "/var/mobile/Containers/Data/Application/.../Library/attachments/"
init() → dynamic
Initialize the attachment queue by
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
saveFile(String fileId, int size) Future<Attachment>
Create a function to save files using the attachment queue
toString() String
A string representation of this object.
inherited
watchIds({String fileExtension = 'jpg'}) StreamSubscription<void>
Create watcher to get list of ID's from a table to be used for syncing in the attachment queue. Set the file extension if you are using a different file type

Operators

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