status property

Derived lifecycle CometChatMessageStatus (foundation §5.3 — "derived, not stored"). Un-acked outbox rows report PENDING / SENDING / FAILED from sendState; otherwise the status is derived from the server receipt timestamps: READ if readAt is set, else DELIVERED if deliveredAt is set, else SENT.

Implementation

CometChatMessageStatus get status {
  switch (sendState) {
    case 'PENDING':
      return CometChatMessageStatus.pending;
    case 'SENDING':
      return CometChatMessageStatus.sending;
    case 'FAILED':
      return CometChatMessageStatus.failed;
  }
  if (readAt != null) return CometChatMessageStatus.read;
  if (deliveredAt != null) return CometChatMessageStatus.delivered;
  return CometChatMessageStatus.sent;
}