diff --git a/lib/src/telegram/model.g.dart b/lib/src/telegram/model.g.dart index d9713db..c9f349c 100644 --- a/lib/src/telegram/model.g.dart +++ b/lib/src/telegram/model.g.dart @@ -3387,7 +3387,8 @@ Map _$MessageIdToJson(MessageId instance) => { MessageOriginChannel _$MessageOriginChannelFromJson( Map json) => MessageOriginChannel( - type: $enumDecode(_$MessageOriginTypeEnumMap, json['type']), + type: $enumDecodeNullable(_$MessageOriginTypeEnumMap, json['type']) ?? + MessageOriginType.channel, date: json['date'] as int, chat: Chat.fromJson(json['chat'] as Map), messageId: json['message_id'] as int, @@ -3422,7 +3423,8 @@ const _$MessageOriginTypeEnumMap = { MessageOriginChat _$MessageOriginChatFromJson(Map json) => MessageOriginChat( - type: $enumDecode(_$MessageOriginTypeEnumMap, json['type']), + type: $enumDecodeNullable(_$MessageOriginTypeEnumMap, json['type']) ?? + MessageOriginType.chat, date: json['date'] as int, senderChat: Chat.fromJson(json['sender_chat'] as Map), authorSignature: json['author_signature'] as String?, @@ -3448,7 +3450,8 @@ Map _$MessageOriginChatToJson(MessageOriginChat instance) { MessageOriginHiddenUser _$MessageOriginHiddenUserFromJson( Map json) => MessageOriginHiddenUser( - type: $enumDecode(_$MessageOriginTypeEnumMap, json['type']), + type: $enumDecodeNullable(_$MessageOriginTypeEnumMap, json['type']) ?? + MessageOriginType.hiddenUser, date: json['date'] as int, senderUserName: json['sender_user_name'] as String, ); @@ -3463,7 +3466,8 @@ Map _$MessageOriginHiddenUserToJson( MessageOriginUser _$MessageOriginUserFromJson(Map json) => MessageOriginUser( - type: $enumDecode(_$MessageOriginTypeEnumMap, json['type']), + type: $enumDecodeNullable(_$MessageOriginTypeEnumMap, json['type']) ?? + MessageOriginType.user, date: json['date'] as int, senderUser: User.fromJson(json['sender_user'] as Map), ); diff --git a/lib/src/telegram/models/message_origin_channel.dart b/lib/src/telegram/models/message_origin_channel.dart index 44009a2..fa91b46 100644 --- a/lib/src/telegram/models/message_origin_channel.dart +++ b/lib/src/telegram/models/message_origin_channel.dart @@ -32,7 +32,7 @@ class MessageOriginChannel implements MessageOrigin { String? authorSignature; MessageOriginChannel({ - required this.type, + this.type = MessageOriginType.channel, required this.date, required this.chat, required this.messageId, diff --git a/lib/src/telegram/models/message_origin_chat.dart b/lib/src/telegram/models/message_origin_chat.dart index a3489b5..3bb3387 100644 --- a/lib/src/telegram/models/message_origin_chat.dart +++ b/lib/src/telegram/models/message_origin_chat.dart @@ -31,7 +31,7 @@ class MessageOriginChat implements MessageOrigin { String? authorSignature; MessageOriginChat({ - required this.type, + this.type = MessageOriginType.chat, required this.date, required this.senderChat, this.authorSignature, diff --git a/lib/src/telegram/models/message_origin_hidden_user.dart b/lib/src/telegram/models/message_origin_hidden_user.dart index 15acce2..63147a7 100644 --- a/lib/src/telegram/models/message_origin_hidden_user.dart +++ b/lib/src/telegram/models/message_origin_hidden_user.dart @@ -30,7 +30,7 @@ class MessageOriginHiddenUser implements MessageOrigin { String senderUserName; MessageOriginHiddenUser({ - required this.type, + this.type = MessageOriginType.hiddenUser, required this.date, required this.senderUserName, }); diff --git a/lib/src/telegram/models/message_origin_user.dart b/lib/src/telegram/models/message_origin_user.dart index 924fb32..a2ab37a 100644 --- a/lib/src/telegram/models/message_origin_user.dart +++ b/lib/src/telegram/models/message_origin_user.dart @@ -30,7 +30,7 @@ class MessageOriginUser implements MessageOrigin { User senderUser; MessageOriginUser({ - required this.type, + this.type = MessageOriginType.user, required this.date, required this.senderUser, });