toModel method

ChatInfoAction toModel()

Constructs a new ChatInfo from this NestedChatForwardMixin$Quote$ChatInfoQuote$Action.

Implementation

ChatInfoAction toModel() {
  if ($$typename == 'ChatInfoActionAvatarUpdated') {
    final model =
        this as ChatInfoQuoteMixin$Action$ChatInfoActionAvatarUpdated;
    return ChatInfoActionAvatarUpdated(model.avatar?.toModel());
  } else if ($$typename == 'ChatInfoActionCreated') {
    final model = this as ChatInfoQuoteMixin$Action$ChatInfoActionCreated;
    return ChatInfoActionCreated(model.directLinkSlug);
  } else if ($$typename == 'ChatInfoActionMemberAdded') {
    final model = this as ChatInfoQuoteMixin$Action$ChatInfoActionMemberAdded;
    return ChatInfoActionMemberAdded(
      model.user.toModel(),
      model.directLinkSlug,
    );
  } else if ($$typename == 'ChatInfoActionMemberRemoved') {
    final model =
        this as ChatInfoQuoteMixin$Action$ChatInfoActionMemberRemoved;
    return ChatInfoActionMemberRemoved(model.user.toModel());
  } else if ($$typename == 'ChatInfoActionNameUpdated') {
    final model = this as ChatInfoQuoteMixin$Action$ChatInfoActionNameUpdated;
    return ChatInfoActionNameUpdated(model.name);
  }

  throw Exception('Unexpected ChatInfoAction: ${$$typename}');
}