create static method

Message create({
  1. bool schemeUtilsIsSetDefaultData = false,
  2. String special_type = "message",
  3. String? id,
  4. User? from,
  5. Chat? chat,
  6. bool? is_group,
  7. bool? is_outgoing,
  8. num? date,
  9. String? type,
  10. String? text,
  11. bool? is_forward,
  12. ForwardFromChat? forward_from_chat,
  13. Photo? photo,
  14. Poll? poll,
  15. Audio? audio,
  16. Contact? contact,
  17. Document? document,
  18. Sticker? sticker,
  19. Video? video,
  20. 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);
}