toDto method

DtoChatItem toDto(
  1. ChatItemsCursor cursor
)

Constructs a new DtoChatItems from this ChatMessageMixin.

Implementation

DtoChatItem toDto(ChatItemsCursor cursor) {
  List<DtoChatItemQuote> items = repliesTo.map((e) => e.toDto()).toList();

  return DtoChatMessage(
    ChatMessage(
      id,
      chatId,
      author.toModel(),
      at,
      repliesTo: items.map((e) => e.value).toList(),
      text: text,
      editedAt: editedAt,
      attachments: attachments.map((e) => e.toModel()).toList(),
    ),
    cursor,
    ver,
    items.map((e) => e.cursor).toList(),
  );
}