enqueueOfflineAttachment method

  1. @override
void enqueueOfflineAttachment({
  1. required String roomId,
  2. required Uint8List bytes,
  3. required String mimeType,
  4. ChatFailure? causeFailure,
  5. String? fileName,
  6. MessageType messageType = MessageType.attachment,
  7. String? text,
  8. Map<String, dynamic>? metadata,
  9. String? tempId,
  10. String? clientMessageId,
})
override

Queues an attachment upload+send for automatic retry once the connection returns, instead of requiring the caller to re-drive the whole upload manually.

Call this from an upload-failure branch — i.e. AFTER ChatAttachmentsApi.upload already failed — passing the failure that caused it as causeFailure so the client can decide whether it is safe to retry (a NetworkFailure or TimeoutFailure queues; a permanent failure like ValidationFailure or AuthFailure does not). tempId should match the optimistic bubble's id: when the queued retry eventually succeeds, onOfflineMessageSent fires with it so the UI can reconcile the bubble exactly like a queued text send. A no-op on clients without an offline queue configured (ChatConfig.cacheConfig null) — the caller has already shown its own failed/manual-retry state and there is nothing durable to fall back to.

Implementation

@override
void enqueueOfflineAttachment({
  required String roomId,
  required Uint8List bytes,
  required String mimeType,
  ChatFailure? causeFailure,
  String? fileName,
  MessageType messageType = MessageType.attachment,
  String? text,
  Map<String, dynamic>? metadata,
  String? tempId,
  String? clientMessageId,
}) {}