toModel method
Implementation
Chat toModel() => Chat(
id,
avatar: avatar?.toModel(),
name: name,
members:
members.nodes
.map((e) => ChatMember(e.user.toModel(), e.joinedAt))
.toList(),
kindIndex: kind.index,
isHidden: isHidden,
muted:
muted != null
? muted!.$$typename == 'MuteForeverDuration'
? MuteDuration.forever()
: MuteDuration.until(
(muted! as ChatMixin$Muted$MuteUntilDuration).until,
)
: null,
directLink:
directLink != null
? ChatDirectLink(
slug: directLink!.slug,
usageCount: directLink!.usageCount,
createdAt: createdAt,
)
: null,
createdAt: createdAt,
updatedAt: updatedAt,
lastReads: lastReads.map((e) => LastChatRead(e.memberId, e.at)).toList(),
lastDelivery: lastDelivery,
lastItem: lastItem?.toDto().value,
lastReadItem: lastReadItem?.toDto().value.id,
unreadCount: unreadCount,
totalCount: totalCount,
ongoingCall: ongoingCall?.toModel(),
favoritePosition: favoritePosition,
membersCount: members.totalCount,
);