MockAttachmentsApi class

Implemented types

Constructors

MockAttachmentsApi()

Properties

failNextUpload bool
When true, the next upload call fails with a NetworkFailure instead of succeeding, then resets to false. Lets a test exercise the upload-failure path (e.g. sendAttachment marking the optimistic bubble failed) without a bespoke fake.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
uploadAttachmentId String Function(int uploadNumber)?
Mints the id upload answers with, given the 1-based call number. null (default) answers mock-attachment-1 for every call, so a single-upload test can hardcode it. Set (n) => 'mock-attachment-$n' when the test needs consecutive uploads to be distinguishable.
getter/setter pair
uploadCount int
How many times upload has been called, failures included. Lets a test assert that a path which re-posts an already-uploaded blob — a retrySend on an attachment whose send failed — does not upload the bytes a second time.
getter/setter pair
uploadedMimeTypes List<String>
MIME type of every upload call, in order. Lets a test assert that a path uploading more than one blob — sendAttachment on a video, which posts the clip and then its poster frame — sent the right payloads.
final

Methods

deleteInRoom(String roomId, String messageId) Future<ChatResult<void>>
Deletes an attachment message from a room.
override
download(String attachmentId, {String? roomId, String? metadata, void onProgress(int received, int total)?}) Future<ChatResult<Uint8List>>
Downloads an attachment's binary data by ID.
override
downloadFromUrl(String url, {void onProgress(int received, int total)?}) Future<ChatResult<Uint8List>>
Downloads an attachment's binary data from a stored URL.
override
listInRoom(String roomId, {ChatCursorPaginationParams? pagination}) Future<ChatResult<ChatPaginatedResponse<ChatMessage>>>
Lists messages with attachments in a room.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
signedUrl(String attachmentId, {required String roomId}) Future<ChatResult<AttachmentSignedUrl>>
Resolves a short-lived signed download URL for an attachment.
override
toString() String
A string representation of this object.
inherited
upload(Uint8List data, String mimeType, {void onProgress(int received, int total)?, UploadCancelToken? cancelToken}) Future<ChatResult<AttachmentUploadResult>>
Uploads binary data as an attachment. The onProgress callback reports upload progress.
override

Operators

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