MessageOrigin class sealed

This object describes the origin of a message. It can be one of

  • MessageOriginUser
  • MessageOriginHiddenUser
  • MessageOriginChat
  • MessageOriginChannel
Annotations
  • @Freezed(fromJson: true, toJson: true, unionKey: 'type', unionValueCase: FreezedUnionCase.snake)

Constructors

MessageOrigin.channel({@JsonKey(name: 'type', defaultValue: MessageOriginType.channel) @Default(MessageOriginType.channel) MessageOriginType type, @JsonKey(name: 'date', required: true) required int date, @JsonKey(name: 'chat') required Chat chat, @JsonKey(name: 'message_id') required int messageId, @JsonKey(name: 'author_signature') String? authorSignature})
Message was originally sent to a channel chat
const
factory
MessageOrigin.chat({@JsonKey(name: 'type', defaultValue: MessageOriginType.chat) @Default(MessageOriginType.chat) MessageOriginType type, @JsonKey(name: 'date', required: true) required int date, @JsonKey(name: 'sender_chat') required Chat senderChat, @JsonKey(name: 'author_signature') String? authorSignature})
Message was originally sent on behalf of a chat
const
factory
MessageOrigin.fromJson(Map<String, Object?> json)
factory
MessageOrigin.hiddenUser({@JsonKey(name: 'type', defaultValue: MessageOriginType.hiddenUser) @Default(MessageOriginType.hiddenUser) MessageOriginType type, @JsonKey(name: 'date', required: true) required int date, @JsonKey(name: 'sender_user_name') required String senderUserName})
Message was originally sent by an unknown user
const
factory
MessageOrigin.user({@JsonKey(defaultValue: MessageOriginType.user, name: 'type') @Default(MessageOriginType.user) MessageOriginType type, @JsonKey(required: true, name: 'date') required int date, @JsonKey(name: 'sender_user') required User senderUser})
Message was originally sent by a known user
const
factory

Properties

copyWith → $MessageOriginCopyWith<MessageOrigin>
Create a copy of MessageOrigin with the given fields replaced by the non-null parameter values.
no setterinherited
date int
Date the message was sent originally in Unix time
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type MessageOriginType
Type of the message origin, must be "user"
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Serializes this MessageOrigin to a JSON map.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited