toModel method

MyUser toModel()

Constructs a new MyUser from this MyUserMixin.

Implementation

MyUser toModel() => MyUser(
  id: id,
  num: this.num,
  online: online.$$typename == 'UserOnline',
  login: login,
  name: name,
  bio: bio,
  hasPassword: hasPassword,
  unreadChatsCount: unreadChatsCount,
  chatDirectLink: chatDirectLink != null
      ? ChatDirectLink(
          slug: chatDirectLink!.slug,
          usageCount: chatDirectLink!.usageCount,
          createdAt: chatDirectLink!.createdAt,
        )
      : null,
  avatar: avatar?.toModel(),
  status: status,
  presenceIndex: presence.index,
  emails: MyUserEmails(
    confirmed: emails.confirmed,
    unconfirmed: emails.unconfirmed,
  ),
  phones: MyUserPhones(confirmed: []),
  muted: muted != null
      ? muted!.$$typename == 'MuteForeverDuration'
            ? MuteDuration.forever()
            : MuteDuration.until(
                (muted! as MyUserMixin$Muted$MuteUntilDuration).until,
              )
      : null,
  lastSeenAt: online.$$typename == 'UserOffline'
      ? (online as MyUserMixin$Online$UserOffline).lastSeenAt
      : null,
  welcomeMessage: welcomeMessage?.toModel(),
);