create static method
Message
create({
- bool schemeUtilsIsSetDefaultData = false,
- String special_type = "message",
- String? id,
- User? from,
- Chat? chat,
- bool? is_group,
- bool? is_outgoing,
- num? date,
- String? type,
- String? text,
- bool? is_forward,
- ForwardFromChat? forward_from_chat,
- Photo? photo,
- Poll? poll,
- Audio? audio,
- Contact? contact,
- Document? document,
- Sticker? sticker,
- Video? video,
- bool? isbaileys,
override
Generated
Implementation
static Message create({
bool schemeUtilsIsSetDefaultData = false,
String special_type = "message",
String? id,
User? from,
Chat? chat,
bool? is_group,
bool? is_outgoing,
num? date,
String? type,
String? text,
bool? is_forward,
ForwardFromChat? forward_from_chat,
Photo? photo,
Poll? poll,
Audio? audio,
Contact? contact,
Document? document,
Sticker? sticker,
Video? video,
bool? isbaileys,
}) {
// Message message = Message({
final Map message_data_create_json = {
"@type": special_type,
"id": id,
"from": (from != null) ? from.toJson() : null,
"chat": (chat != null) ? chat.toJson() : null,
"is_group": is_group,
"is_outgoing": is_outgoing,
"date": date,
"type": type,
"text": text,
"is_forward": is_forward,
"forward_from_chat":
(forward_from_chat != null) ? forward_from_chat.toJson() : null,
"photo": (photo != null) ? photo.toJson() : null,
"poll": (poll != null) ? poll.toJson() : null,
"audio": (audio != null) ? audio.toJson() : null,
"contact": (contact != null) ? contact.toJson() : null,
"document": (document != null) ? document.toJson() : null,
"sticker": (sticker != null) ? sticker.toJson() : null,
"video": (video != null) ? video.toJson() : null,
"isBaileys": isbaileys,
};
message_data_create_json.removeWhere((key, value) => value == null);
if (schemeUtilsIsSetDefaultData) {
defaultData.forEach((key, value) {
if (message_data_create_json.containsKey(key) == false) {
message_data_create_json[key] = value;
}
});
}
return Message(message_data_create_json);
}