toDto method

DtoChatItemQuote toDto()

Constructs a new DtoChatItems from this NestedChatForwardMixin$Quote.

Implementation

DtoChatItemQuote toDto() {
  if ($$typename == 'ChatMessageQuote') {
    final q = this as NestedChatForwardMixin$Quote$ChatMessageQuote;
    return DtoChatItemQuote(
      ChatMessageQuote(
        text: q.text,
        attachments: q.attachments.map((e) => e.toModel()).toList(),
        author: author.id,
        at: at,
      ),
      original?.cursor,
    );
  } else if ($$typename == 'ChatCallQuote') {
    return DtoChatItemQuote(
      ChatCallQuote(author: author.id, at: at),
      original?.cursor,
    );
  } else if ($$typename == 'ChatInfoQuote') {
    final q = this as NestedChatForwardMixin$Quote$ChatInfoQuote;
    return DtoChatItemQuote(
      ChatInfoQuote(action: q.action.toModel(), author: author.id, at: at),
      original?.cursor,
    );
  }

  throw Exception('$this is not implemented');
}